Array_push () can implement the PHP language stack function.
array_push()函数的使用心得1.第一个参数必须是数组。2.所有添加的数组均为索引,即数组下标。3.$num为压入后$stack所含数组元素的个数。4.使用数组的直接赋值也可以实现数组的进栈功能,例如$array$key。$num = array_push($stack"C#""Ruby"array('jsp''Asp'),array('jsp''Asp'));
Array_pop () can implement the queue function of the PHP language.
arrayarrayarrayNULL。 此外如果被调用不是一个数则会产生一个 Warning。
$stack = array("orange", "banana", "apple", "raspberry");$fruit = array_pop($stack);print_r($stack);?>Array( [0] => orange [1] => banana [2] => apple)
Array_shift-moves the cell at the beginning of the array to a group
arrayarray 的长度减一并将所有其它单元向前移动一位。所有的数字键名将改为从零开始计数,文字键名将不变。
****array_unshift — 在数组开头插入一个或多个单元****
int Array_unshift (array & aRray,m I x e D var [, mixed $ ...])
Array_unshift () Inserts the incoming cell at the beginning of the array. Note that the unit is inserted as a whole, because
This incoming unit will remain in the same order. All numeric key names are modified to count back from zero, and all text key names remain unchanged.
$queue = array("orange", "banana");array_unshift($queue, "apple", "raspberry");print_r($queue);?>以上例程会输出:Array( [0] => apple [1] => raspberry [2] => orange [3] => banana)
'). addclass (' pre-numbering '). Hide (); $ (this). addclass (' has-numbering '). Parent (). append ($numbering); for (i = 1; i <= lines; i++) {$numbering. Append ($ ('
'). Text (i)); }; $numbering. FadeIn (1700); }); });
The above describes the use of arrays to implement the stack and queue, including the queue, the use of the content, I hope to be interested in PHP tutorial friends helpful.