egis egis - 1 year ago 43
PHP Question

php object attribute with dot in name

I have mysql table with collumns like '', '' and etc.
After fetching that table data as object with

i get this (print_r of row):

stdClass Object
[id] => 2
[] => 2010-12-15
[] => some_name

how do I acces
and all other weirdly named object properties?

rik rik
Answer Source

Specify aliases in your SQL query like SELECT column AS nameWithoutDots ...
or access these properties with $object->{''}
or cast the object to array like this: $obj = (array)$obj; echo $obj[''].