FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » mysql_fetch_array
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: mysql_fetch_array [message #169790 is a reply to message #169774] Sun, 26 September 2010 23:24 Go to previous messageGo to previous message
sheldonlg is currently offline  sheldonlg
Messages: 166
Registered: September 2010
Karma:
Senior Member
On 9/26/2010 7:44 AM, Captain Paralytic wrote:
> On Sep 26, 12:36 am, MikeB<mpbr...@gmail.com> wrote:
>> Captain Paralytic wrote:
>>> On Sep 25, 9:28 pm, MikeB<mpbr...@gmail.com> wrote:
>>>> I have the following code:
>> <snip>
>>
>>>> What PHP magic is at work here?
>>
>>>> Thanks.
>>
>>> I can recommend reading:
>>> http://php.net/manual/en/language.types.array.php
>>
>> I've read that page before, but only now the following sentence makes
>> sense:
>>
>> "If a key is not specified for a value, the maximum of the integer
>> indices is taken and the new key will be that value plus 1. If a key
>> that already has an assigned value is specified, that value will be
>> overwritten. "
>
> I was referring to the section just below headed:
> "Creating/modifying with square bracket syntax"
> but the paragraph that you mentioned certainly explains more of the
> actual details.

You know, that ("the maximum of the integer indices is taken and the new
key will be that value plus 1") is possibly a misleading clause.

For example:

$results = array();
$results[] = 'First One';

Reading that clause, "the maximum of the integer indices is taken and
the new key will be that value plus 1", one might expect the index of
"First One" to be 1. In fact, of course, it is 0. IOW, if there is no
index yet, then it doesn't add 1, but takes the first one as 0.

--
Shelly
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Group sort syntax?
Next Topic: Code to create a cookie in PHP
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sat Nov 30 11:46:35 GMT 2024

Total time taken to generate the page: 0.04342 seconds