oop - How can I access a property of an object in php by its index location -
in code want access property of object in php using index value, can access using name not using index value:
i can :
foreach($object $row) { echo $row['type']; }
i want this:
foreach($object $row) { echo $row[0]; }
try this:
$arr = array_values((array) $object); foreach ($arr $row) { echo $row[0]; }
updated:
i think, in case, have convert array each row, this:
foreach ($object $row) { $row = array_values((array) $row); echo $row[0]; }
Comments
Post a Comment