tedd wrote:
At 4:14 PM -0400 9/19/07, brian wrote:
tedd wrote:
>>>
Duh?
You program for that -- you want me to write the entire code?
~sigh~
Grasshopper, the point i was trying to make is that your example
displays what *not* to do with array_search(). Though a wonderful
teaching aid in itself, it falls somewhat short of being a reasonable
solution for the OP.
brian
~sigh~
Sorry to disappoint you master. But I was using array_search() to search
an array -- it seemed like a reasonable thing to do.
OK, so my joke left a bitter taste; sorry about that.
What i'm trying to get across is that this list is here so that we may
post our various problems in the hopes that someone else might see the
solution we are missing. Sometimes, when we post what we *think* is the
correct path to scripting Nirvana, another of us may point out a flaw in
our logic.
It happens to all of us.
The responses to this list should not be taken to be either complete or
fully-tested solutions. But, neither should potential bugs be ignored if
noticed by any other reader. While your response certainly does *seem*
to work just fine, it contains a bug that *will* bite at some point.
So why do you say it's an example of what *not* to do with array_search()?
Please be specific.
Do you really expect me to "write the entire code"? Perhaps you could
just meditate on this a little longer:
>>>> Not quite:
>>>>
>>>> $array = array('0','1','3','5','8','15','25');
>>>> $val = "25";
>>>>
>>>> echo($array[array_search($val, $array)+1]);
>>>>
>>>> Notice: Undefined offset: 7 ...
>>>>
brian
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php