Sunday 4 March 2018

PHP Code | Add Parent On Array | Parent Child JSON Array Using PHP


code in php to add parent Element on array
<?php
$array1=array();
for($i=1;$i<=10;$i++)
{
    array_push($array1,['id'=>$i]);
}
$array2->numbers=$array1;
echo $final_output= json_encode($array2);
?>