Hi again Michael:

Digging documentation I found out that this behaviour (string and int keys)
is native for mysql_fetch_arrow() (found into the help: 'In addition to
storing the data in the numeric indices of the result array, it also stores
the data in associative indices, using the field names as keys. ')

So the question is answered. Thank you for your help.

Best regards

Ivo


"Michael Sims" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> At 09:18 PM 1/10/2002 +0100, Ivo Stoykov wrote:
> >How could I determine whether I have in the array's key integers *and*
> >strings or integers only?
>
> I'm not sure exactly what you're asking but I'll give it a shot...
>
> >i.e.
> >$a = new array('one', 'two', 'three'); // this has only integers (am I
> >wrong?)
>
> First of all, the "new" keyword assumes that you are instantiating an
> object.  For example if you created an object with the name foo you would
> instantiate it like so:
>
> $a = new foo;
>
> So when creating arrays the "new" keyword is undesirable.
>
> To address your question, yes your example above (after removing the "new"
> keyword) will create an array named $a that has only integers for
> keys.  It's functionally the same as this:
>
> $a = array(0 => 'one', 1 => 'two', 2 => 'three');
>
> >$b = new array('one' => 'bla', 'two' => 'blabla', 'three' =>
'blablabla');
> >// integers & strings
>
> The above example (again once corrected to remove the "new" keyword) will
> create an array named $b that has ONLY strings for keys.  There are no
keys
> that are integers because you didn't create any.  You can test this by
> trying to echo the values out by key:
>
> echo $b['one']; //outputs "bla"
> echo $b[0]; //outputs nothing because this key does not have a value.
>
> This is perfectly legal:
>
> $b = array ('one' => 'bla', 'two' => 'blabla', 'three' => 'blablabla', 0
=>
> 'blablablabla',
> 1 => 'blablablablabla');
>
> In the above case you do have some keys that are strings and some that are
> integers but they are DIFFERENT keys, representing DIFFERENT values.
>
> Hope that answers your question...
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to