note 53958 added to function.array-search
| From: | (dot) | Date: | Sat, 18 Jun 2005 18:44:26 +0000 |
| Subject: | note 53958 added to function.array-search | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-90631@lists.php.net to get a copy of this message | ||
In answer to "info" at jake the spud dot com
This code doesn't work in all cases and may have unexpected results.
For example, it you have this code:
$array2search = array("pat","ter", "n");
if( strpos( implode( "", $array2search), "pattern" ) > -1 )
{
// You will be there ... but "pattern" does not exist in the array ...
// something is wrong !
}
There is no real solution using this code even if you try to enclose your elements by a special char
... because the special char could be part of the pattern.
If it works for you, it won't work in all cases.
/benoit
----
Manual Page -- http://www.php.net/manual/en/function.array-search.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+53958
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+53958&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+53958&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+53958&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+53958&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+53958&report=yes&reason=non-english
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+53958&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+53958&report=yes
Search -- http://master.php.net/manage/user-notes.php