This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
rfc:str_contains [2020/02/17 12:01]
rfc:str_contains [2020/02/17 12:08]
Line 37: Line 37:
 // $needle is an empty string // $needle is an empty string
-str_contains("abc", ""); // true +str_contains("abc", "");  // true 
-str_contains("", ""); // true+str_contains("", "");     // true
 </code> </code>
 +Regarding empty string values as $needle:
 +<blockquote>As of PHP 8, behavior of "" in string search functions is well defined, and we consider "" to occur at every position in the string, including one past the end. As such, both of these will (or at least should) return true. The empty string is contained in every string. - Nikita Popov</blockquote>
rfc/str_contains.txt · Last modified: 2020/08/01 23:41 by carusogabriel