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 #169798 is a reply to message #169790] Mon, 27 September 2010 07:44 Go to previous messageGo to previous message
Hamish Campbell is currently offline  Hamish Campbell
Messages: 15
Registered: September 2010
Karma:
Junior Member
On Sep 27, 12:24 pm, sheldonlg <sheldonlg> wrote:
> 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

Except that sharp readers will note that: "As mentioned above, if no
key is specified, the maximum of the existing integer indices is
taken, and the new key will be that maximum value plus 1. If no
integer indices exist yet, the key will be 0 (zero)."

Hamish
[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: Wed Nov 27 12:33:48 GMT 2024

Total time taken to generate the page: 0.11094 seconds