Home >Backend Development >PHP Tutorial >array_push php array_push array function: push one or more cells to the end of the array (push)
Copy code The code is as follows:
/*Function array_push(): Push one or more units to the end of the array (push)
* 1. Syntax: int array_push (array &array, mixed var [, mixed ...] )
* 2. Description: Treat array as a stack and push the passed variable into the end of array. The length of array will increase according to the number of variables pushed onto the stack.
* 3. Notes:
* 3.1. This function returns the total number of new elements in the array
* 3.2. If var is an array, the array is pushed into the array stack as an array variable, which is the length of the original array It is to add a unit
*/
echo "****************************************** *******************************
";
$arr11=array('score 1'=> 65,'Grade 2'=>25,'Grade 3'=>87,'Grade 4'=>85,'Grade 5'=>45,'Grade 6'=>66);
$ arr22=array(a,b,c,d,e);
echo "Information of array arr11:";
echo "
"; <br>print_r($arr11); <br>echo "" ;
"; <br>print_r($arr22); <br>echo "";
"; <br>print_r($arr11); <br>echo "";
"; <br>print_r($arr11); <br>echo "";
Operation results As follows:
The above introduces the array_push php array_push array function: pushing one or more units to the end of the array (push), including the content of array_push. I hope it will be helpful to friends who are interested in PHP tutorials.