At 12:57 PM -0400 7/18/02, Henning Sittler wrote:
>What's the best way to check for an Associative Array? There is no
>is_assoc() or similiar function listed in the manual (I don't think anyway).
No, because AFAIK all PHP arrays are associative; there is no
distinction between arrays & hashes
y, July 18, 2002 10:57 AM
Subject: [PHP] Check for Associative Array
> What's the best way to check for an Associative Array? There is no
> is_assoc() or similiar function listed in the manual (I don't think
anyway).
>
> I'm using mysql_fetch_array() and I want to fo
Oh well. And HTH means "Hope to Help".
> For some unknown reason the OP specifically does not want to use
> mysql_fetch_assoc()!
Martin Clifford
Homepage: http://www.completesource.net
Developer's Forums: http://www.completesource.net/forums/
--
PHP General Mailing List (http://www.php.net/
On Friday 19 July 2002 01:19, Martin Clifford wrote:
> Try this:
>
> while($row = mysql_fetch_assoc($result)) {
> // code here
> }
>
> This way, the resulting array will ONLY be associative.
For some unknown reason the OP specifically does not want to use
mysql_fetch_assoc()!
> I'm using my
Ya, except I want the whole array to exist (index and assoc. array), not
just the assoc. array. So, for the time being, I'll just do this:
foreach ($arr as $key=>$value) {
if ( !is_int($key) ) { echo "$key:$value"; }
}
What is HTH ??
Henning Sittler
www.inscriber.com
Try this:
while($ro
Try this:
while($row = mysql_fetch_assoc($result)) {
// code here
}
This way, the resulting array will ONLY be associative.
HTH!
Martin Clifford
Homepage: http://www.completesource.net
Developer's Forums: http://www.completesource.net/forums/
>>> Henning Sittler <[EMAIL PROTECTED]> 07/18
What's the best way to check for an Associative Array? There is no
is_assoc() or similiar function listed in the manual (I don't think anyway).
I'm using mysql_fetch_array() and I want to foreach only the assoc. part of
the array without using mysql_fetch_assoc():
foreach ($arr as $key=>$value)
7 matches
Mail list logo