I want to display multiple arrays into one such that each time the object is created it get a key value and then forms a object to be more specific following is a short example.
How it is now:
name:[{},{},{},{}]
surname:[{},{},{},{}]
phone: [{},{},{},{}]
How I want it to be:
xyz:[{name:{}, surname{}, phone{}},
{name:{}, surname{}, phone{}},
{name:{}, surname{}, phone{}}]
I am exporting this in php so that I can use this JSON object in AngularJs ng-repeat directive.
following is the code:
declaring array:
$name = array(); $surname= array(); $phone= array();assigning values WHICH IS UNDER FOR EACH LOOP
$name[] = $values ($values wil have the values for the loop) .....testing output
<?php echo json_encode($name); echo json_encode($surname); echo json_encode($phone); ?>