spl 库, 数据结构类
- SplStack() 先进后出- 栈
$stack = new SplStack();
$stack->push('d1');
$stack->push('d2');
echo $stack->pop(); d2
echo $stack->pop(); d1
- SplQueue() 先进先出- 队列
$queue = new SplQueue():
$queue->enqueue('data1');
$queue->enqueue('data2');
echo $queue->dequeue(); data1
echo $queue->dequeue(); data2
- SplMinHeap() 堆
$heap = new SplMinHeap();
$heap->insert('k1');
$heap=>insert('k2');
echo $heap->extract(); k1
echo $heap->extract(); k1
- SplFixedArray() 固定尺寸数组
$arr = new SplFixedArray(10);
$arr[0] = 000;
$arr[1] = 111;
var_dump($arr);