PHP Programing language

adplus-dvertising
array_push() Function in PHP
Previous Home Next
adplus-dvertising

array_push()

The array_push() function inserts one or more elements to the end of an array.

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

In above syntax, "array" specifies an array, "value1" specifies the value to add and "value2" specifies the value to add

Example:

<?php
$a=array("Apple","Banana");
array_push($a,"Mango","Orange");
print_r($a);
?>

Output:

Array ( [0] => Apple [1] => Banana [2] => Mango [3] => Orange )

Previous Home Next