Copy codeThe Code is as follows:
<? Php
/* Function array_push (): pushes one or more units to the end of the array (into the stack)
* 1. Syntax: int array_push (array & array, mixed var [, mixed...])
* 2. Description: Use array as a stack and press the passed variables to the end of array. The length of array increases according to the number of variables in 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 written into the array stack as an array variable. That is, the length of the original array is increased by a unit.
*/
Echo "************************************** ******************************** <br> ";
$ Arr11 = array ('score 1' => 65, 'score 2' => 25, 'score 3' => 87, 'score 4' => 85, 'score 5' => 45, 'score 6' => 66 );
$ Arr22 = array (a, B, c, d, e );
Echo "array arr11 information :";
Echo "<pre> ";
Print_r ($ arr11 );
Echo "</pre> ";
Echo "array arr22 information :";
Echo "<pre> ";
Print_r ($ arr22 );
Echo "</pre> ";
Echo "the number of original elements of array arr1 is:". count ($ arr11). "<br/> ";
$ Num1 = array_push ($ arr11, 66,100 );
Echo "after stack entry, the total number of elements in the array is:". $ num1 ."! In this case, the elements of the array are: <br/> ";
Echo "<pre> ";
Print_r ($ arr11 );
Echo "</pre> ";
$ Num2 = array_push ($ arr11, $ arr22 );
Echo "after the array arr22 is pushed to the array arr11 :";
Echo "after stack entry, the total number of elements in the array is:". $ num2 ."! In this case, the elements of the array are: <br/> ";
Echo "<pre> ";
Print_r ($ arr11 );
Echo "</pre> ";
?>
The running result is as follows: