javascript push array code example
Example 1: php add element to array
<?php
$stack = array("orange", "banana");
array_push($stack, "apple", "raspberry");
?>
Example 2: add object in array php
$myArray = array("name" => "my name");
echo json_encode($myArray);