Re: 5.4 regression: non-existent sub-sub keys now have values
| From: | Lester Caine | Date: | Wed, 23 Nov 2011 09:51:35 +0000 |
| Subject: | Re: 5.4 regression: non-existent sub-sub keys now have values | ||
| References: | 1 2 3 4 5 6 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-56494@lists.php.net to get a copy of this message | ||
Ferenc Kovacs wrote:
some clarification: in the test script, Daniel declared $arr as: $arr = array('exists' => 'foo'); so when he tests $arr['exists']['non_existent'] PHP will see that $arr['exists'] is a string, and it will convert the 'non_existent' index to int(0) and that will return the same as $arr['exists'][0]: 'f' If he would have defined $arr['exists'] as an array, then the code would work as he expected, empty would returned true for $arr['exists']['non_existent']The bit I am missing here is the statement that $arr = array ... has NOT created an array with an element ['exists'] ... I suspect that this is perhaps where the code *I* am looking at is breaking down ... how SHOULD you define the array so that it is an array? So that $family = array ( 'fam1' => 'JONES' ); is the base for the JONES family rather than simply a string. All of this USED to be simple, but it seems to be getting so cryptic that this is what is causing the trouble :( -- Lester Caine - G8HFL ----------------------------- Contact - http://lsces.co.uk/wiki/?page=contact L.S.Caine Electronic Services - http://lsces.co.uk EnquirySolve - http://enquirysolve.com/ Model Engineers Digital Workshop - http://medw.co.uk// Firebird - http://www.firebirdsql.org/index.php