On Wed, Nov 23, 2011 at 10:51 AM, Lester Caine <les...@lsces.co.uk> wrote:

> 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']

yes it did, but ['exists'] wasn't defined as an array, but as a string.




> ... 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 :(


I think you just need a coffee.



-- 
Ferenc Kovács
@Tyr43l - http://tyrael.hu

Reply via email to