英[pʊʃ] 美[pʊʃ]

vt.& vi. Push, push

vt. Press; push, increase; exert pressure on, force; persuade

n. Push, determination; large-scale offensive; determined pursuit

vi. Push; increase; strive for

Third person singular: pushes Present participle: pushing Past tense: pushed past Participle: pushed

php array_push() function syntax

Function:Add one or more elements (push) to the end of the array of the first parameter, and then return the length of the new array.

Syntax:array_push(array,value1,value2...)

Parameters:

Parameters Description
array Required. Specifies an array.
value1 Required. Specifies the value to add.
value2 Optional. Specifies the value to add.

Note:Even if there are string key names in the array, the elements you add are always numeric keys. If you use array_push() to add a unit to an array, it is better to use $array[] =, because there is no additional burden of calling the function. array_push() will issue a warning if the first argument is not an array. This is different from the behavior of $var[], which creates a new array.

php array_push() function example

"; print_r($a);//打印新数组 ?>

Run instance»

Click the "Run instance" button to view the online instance

Output:

4 Array ( [0] => 西门 [1] => 灭绝 [2] => 无忌 [3] => 黄蓉 )


"; print_r($a);//打印新数组 ?>

Run Instance»

Click the "Run Instance" button to view the online instance

Output:

3 Array ( [0] => 无忌 [1] => 欧阳克 [2] => 灭绝 )