php append object to aray code example
Example 1: add item to array in php
<?php
$a=array("red","green");
array_push($a,"blue","yellow");
print_r($a);
?>
Example 2: add object in array php
$myArray = array("name" => "my name");
echo json_encode($myArray);