Help understanding a php function - the meaning of $array[]; the [] part

iCracked

New Member
\[code\]private function jsonArray($object){ $json = array(); if(isset($object) && !empty($object)) { foreach($object as $obj) { $json[]["name"] = $obj; } } return $json;}\[/code\]We are grabbing an object, and if the conditional is met, we iterate over that object.Then... I'm lost on this reading... :sWhat's the meaning of the [] here?\[code\]$json[]["name"] = $obj;\[/code\]Thanks in advance,MEM
 
Back
Top