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

Popular posts from this blog

java - Date formats difference between yyyy-MM-dd'T'HH:mm:ss and yyyy-MM-dd'T'HH:mm:ssXXX -

c# - Get rid of xmlns attribute when adding node to existing xml -