#48391 [NEW]: strpos accepting arrays
| From: | anon at example dot com | Date: | Tue, 26 May 2009 00:00:36 +0000 |
| Subject: | #48391 [NEW]: strpos accepting arrays | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-137729@lists.php.net to get a copy of this message | ||
From: anon at example dot com
Operating system:
PHP version: 5.2.9
PHP Bug Type: Feature/Change Request
Bug description: strpos accepting arrays
Description:
------------
I think strpos would be greatly improved if the needle could be an
array - much like preg_match, but without needing the complication of
regex.
The only way around this atm is a foreach loop.
Reproduce code:
---------------
Code 1 - currently
foreach(array('searchterm1', 'searchterm2') as $needle)
if(strpos($haystack, $needle) !== FALSE)
return strpos($haystack, $needle);
Code 2 - why isn't this allowed?
strpos($haystack, array('searchterm1', 'searchterm2'))
--
Edit bug report at http://bugs.php.net/?id=48391&edit=1
--
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=48391&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=48391&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=48391&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=48391&r=fixedcvs
Fixed in CVS and need be documented: http://bugs.php.net/fix.php?id=48391&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=48391&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=48391&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=48391&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=48391&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=48391&r=support
Expected behavior: http://bugs.php.net/fix.php?id=48391&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=48391&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=48391&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=48391&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=48391&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=48391&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=48391&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=48391&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=48391&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=48391&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=48391&r=mysqlcfg