Re: Array strangeness

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jan 4, 2016 at 10:08 AM, Aziz Saleh <azizsaleh@xxxxxxxxx> wrote:

>
>
> On Mon, Jan 4, 2016 at 10:02 AM, Lester Caine <lester@xxxxxxxxxxx> wrote:
>
>> Code is simple enough in long hand ...
>>
>> $surname = array();
>> $name = $row['n_surn'];
>> $cnt = $row['sn_count'];
>> print_r($row);
>> print($name);
>> print($cnt);
>> $surnames[$name]['name'] = $name;
>> $surnames[$name]['match'] = $cnt;
>>
>> Result ...
>> Array ( [n_surn] => CORTEEN [sn_count] => 227 )
>> CORTEEN
>> 227
>> Array ( [CORTEEN] =>
>>     Array ( [name] => CORTEEN
>>             [match] => Array ( [name] => CORTEEN [match] => 227 ) ) )
>>
>> WHY is the [match] an array rather than the 227 value from the original
>> result array.
>> Actual code was not expanded using the intermediate variables, but the
>> problem is that incorrect value in the match field :(
>>
>> --
>> 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
>> Rainbow Digital Media - http://rainbowdigitalmedia.co.uk
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
> That is weird, you are not touching the array $surnames anywhere else.
> Also noticed you are declaring $surname but using the plural version
> $surnames.
>

First sentence was meant as a question (missed the question mark). Sorry
about that!

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux