The use of the PHP array processing function array_push (1) will involve a lot of array operations when using PHP for data processing. here I will write down the use of various array processing functions, so it is better to remember it !!
I. how to use array_push: push one or more units to the end of the array (into the stack)
Description: Int array_push (array & $ array, mixed $ var [, mixed $...])Parameter description: Array is the value to be pushed into the input array $ var.
Here, mixed indicates that this parameter can be of different (but not necessarily all) types.
Array_push () treats array as a stack and pushes the passed variables to the end of array. The length of array increases according to the number of variables in the stack. The effect is the same as the following:
$ Array [] = $ var;
?>
Repeat the preceding actions for each var, which is equivalent to performing multiple value assignment operations on $ array.
Return value:Returns the number of processed array elements.
Note:(1) If array_push () is used to add a unit to the array, it is better to use $ array [] = (assign values directly to the array) because there is no additional burden to call the function.
(2) If the first parameter is not an array, array_push () will issue a warning. This is different from the behavior of $ var []. The latter creates an array.