Re: numerically named member variables and objects
| From: | Dan Field | Date: | Wed, 11 Mar 2009 11:57:46 +0000 |
| Subject: | Re: numerically named member variables and objects | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-289831@lists.php.net to get a copy of this message | ||
On 11 Mar 2009, at 11:42, Dan Field wrote:
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?
echo $this->results->highlighting->000012192->t_text[0];And to answer my own question, the answer is to use the following notation: echo $this->results->highlighting->{'000012192'}->t_text[0]; -- 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