[wp-trac] [WordPress Trac] #19347: Ugly alert: false !== strpos( $which_one_was_needle, $this_one )

WordPress Trac wp-trac at lists.automattic.com
Thu Nov 24 10:10:52 UTC 2011


#19347: Ugly alert: false !== strpos( $which_one_was_needle, $this_one )
---------------------------------------------+-----------------------------
 Reporter:  nbachiyski                       |       Owner:  westi
     Type:  enhancement                      |      Status:  reviewing
 Priority:  normal                           |   Milestone:  Future Release
Component:  General                          |     Version:
 Severity:  normal                           |  Resolution:
 Keywords:  has-patch westi-likes 3.4-early  |
---------------------------------------------+-----------------------------

Comment (by johnbillion):

 Replying to [comment:2 nacin]:
 > Remembering haystack/needle order is a pain and something that all still
 venture to php.net for on a regular basis.
 For array functions and string functions,
 [http://www.php.net/manual/en/faq.using.php#faq.using.parameterorder there
 is actually consistency]. Once you've successfully recalled the correct
 function name, that is.
 > However, wp_in() still ends up being reversed from startswith() and
 endswith().
 These are all string functions so they should accept `$haystack, $needle`.
 merty's suggestion of `wp_has()` works, as does `wp_contains()`.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/19347#comment:4>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list