How to address a numericly named object member variable
Posted: Wed Mar 11, 2009 6:36 am
Using a JSON lib it is creating a resultset which I wish to use, however it has somehow created stdClass variables which have numeric only names and thus are unaddressable by PHP as far as I can tell.
Here's a snippet from a print_r() of the object
if I try this
I get this error
I'm stumped. Any ideas?
Here's a snippet from a print_r() of the object
Code: Select all
[highlighting] => stdClass Object
(
[000012192] => stdClass Object
(
[t_text] => Array
(
[0] =>
[advert]
PRIORY PRESS LIMITED
THE FRIARY - <em>CARDIFF</em>
TELEPHONE 3578
)
)
[000012193] => stdClass Object
(
[t_text] => Array
(
[0] => Religion.
Low Performing Fees
THE BOOK - 1/6
From the Publishers?
PRIORY PRESS LIMITED
The Friary - <em>Cardiff</em>
)
)
Code: Select all
echo $this->results->highlighting->000012192->t_text[0];
Code: Select all
[Wed Mar 11 11:32:57 2009] [error] [client xx.xx.xx.xx] PHP Parse error: syntax error, unexpected T_LNUMBER, expecting T_STRING or T_VARIABLE or '{' or '$' in /var/www/ccymod/application/views/scripts/browse/search.phtml on line 62