Web Development

This part is of the PHP Post Series dedicated to spread knowledge about PHP

array_push is a PHP function used to add elements at the end of an array.

Example Code

$a = array('a', 'b', 'c');
array_push($a, 'c');
var_dump($a);

Results

array(3) { [0]=> string(1) "a" [1]=> string(1) "b" [2]=> string(1) "c" }

Return

array_push returns the number of elements existing in the array.