Req #48391 [Fbk->NoF]: strpos accepting arrays

From: Date: Tue, 30 Dec 2014 10:41:33 +0000
Subject: Req #48391 [Fbk->NoF]: strpos accepting arrays
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-189388@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=48391&edit=1

 ID:             48391
 Updated by:     php-bugs@lists.php.net
 Reported by:    anon at example dot com
 Summary:        strpos accepting arrays
-Status:         Feedback
+Status:         No Feedback
 Type:           Feature/Change Request
 Package:        *General Issues
 PHP Version:    5.2.9
 Private report: N

 New Comment:

No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.


Previous Comments:
------------------------------------------------------------------------
[2014-04-16 19:04:32] levim@php.net

> Code 2 - why isn't this allowed?

It is strictly less useful than the first. 

Is this something you are still interested in?

------------------------------------------------------------------------
[2009-05-26 00:00:36] anon at example dot com

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 this bug report at https://bugs.php.net/bug.php?id=48391&edit=1


Thread (4 messages)

« previous php.bugs (#189388) next »