Hi there,
I am passing an array through the URL with a ',' inbetween:
var=php,mysql,super
Parsing is done with: explode (',',$var). This gives me an array starting
with 0
Later on I have to search for lets say php with array_search.
Unfortunatelly array_search requires an array starting with
.
-Kevin
- Original Message -
From: andy [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, April 25, 2002 10:30 AM
Subject: [PHP] how to make array_search start from 0?
Hi there,
I am passing an array through the URL with a ',' inbetween:
var=php,mysql,super
Parsing is done
If the key is 0, array_search will return 0, it does not
start at 1.
$arr = array('apple','banana','cranberry');
$key = array_search('apple', $arr);
print $key; // 0
If 'apple' was not found, $key would then equal
to boolean false. Be sure to use === false
to check failure because 0
-Original Message-
From: Kevin Stone [mailto:[EMAIL PROTECTED]]
Sent: 25 April 2002 18:02
Just looking at the manual here and it explains quite
specifically that
array_search() is meant to be used with associative arrays,
not indexed
arrays.
No it doesn't. How on earth did
On Friday 26 April 2002 00:30, andy wrote:
Hi there,
I am passing an array through the URL with a ',' inbetween:
var=php,mysql,super
Parsing is done with: explode (',',$var). This gives me an array starting
with 0
Later on I have to search for lets say php with array_search.
PROTECTED]; PHP-general
[EMAIL PROTECTED]
Sent: Thursday, April 25, 2002 11:12 AM
Subject: RE: [PHP] how to make array_search start from 0?
-Original Message-
From: Kevin Stone [mailto:[EMAIL PROTECTED]]
Sent: 25 April 2002 18:02
Just looking at the manual here and it explains
-Original Message-
From: andy [mailto:[EMAIL PROTECTED]]
Sent: 25 April 2002 17:30
I am passing an array through the URL with a ',' inbetween:
var=php,mysql,super
Parsing is done with: explode (',',$var). This gives me an
array starting
with 0
Later on I have to search for
I can see what u are saying. Its all about the ===
Anyhow.. this thing does not work in a loop. I guess this is my prob. There
might be something wrong with the boolean. I tryed it with different
settings, but still wrong:
Here is what I mean:
$fruit = array('apple','banana','cranberry');
I can see what u are saying. Its all about the ===
Anyhow.. this thing does not work in a loop. I guess this is my prob. There
might be something wrong with the boolean. I tryed it with different
settings, but still wrong:
Here is what I mean:
$fruit = array('apple','banana','cranberry');
: Thursday, April 25, 2002 11:39 AM
Subject: Re: [PHP] how to make array_search start from 0?
I can see what u are saying. Its all about the ===
Anyhow.. this thing does not work in a loop. I guess this is my prob.
There
might be something wrong with the boolean. I tryed it with different
10 matches
Mail list logo