numerically named member variables and objects
| From: | Dan Field | Date: | Wed, 11 Mar 2009 11:42:45 +0000 |
| Subject: | numerically named member variables and objects | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-289828@lists.php.net to get a copy of this message | ||
As far as I was aware, member variable and object names had to start with a non integer chracter, however I am utilising a JSON lib which is providing me with the following resultset. As you can see a member class member is numerically named and I am unable to address it in the usual way. Is there a way around this?
Here's a snippet from a print_r() of the object
[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>
)
)echo $this->results->highlighting->000012192->t_text[0]; results in [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 I'm stumped. Any ideas? -- Dan Field <dof@llgc.org.uk> Ffôn/Tel. +44 1970 632 582 Peiriannydd Meddalwedd Senior Software Engineer Llyfrgell Genedlaethol Cymru National Library of Wales