Account
Categories

array_push()


When you use this function on an array, it inserts values into that array and increases the length of that array.

Syntax:

array_push($array_name, value1, value2, ...);

Example:

$fruits = array("Apple", "Banana");
array_push($fruits, "Mango", "Orange");
print_r($fruits);

Output:

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