On Mar 31, 2011, at 9:43 AM, Brian Moon wrote:

>>> How would str_contains() be different from strstr()?
>>> 
>>> 
>> They differ in the return type
> 
> $instr = (bool)strstr($string1, $string2);
> 
> done. No need for a new function.

Well, to be clearer:

bool str_contains( haystack, needle [, case_insensitive = false ] )
string str[i]str( haystack, needle [, $before_needle = false ] )

The main differences:
- Return value is a bool
- No ordinal value conversions (I assume)
- No === usage worries/requirements
- Intuitive name

Regards,
Philip

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to