Closed coffeecore closed 5 years ago
@coffeecore Yep, nice catch! What do you think if I just fix it to this:
function isContains($string, $needle)
{
return strpos($string, $needle) != -1;
}
I think better way :
function isContains($string, $needle)
{
return false !== strpos($string, $needle);
}
Hello.
I think this snippet is wrong : https://github.com/petrovicstefanrs/30_seconds_of_knowledge/blob/master/src/assets/snippets/php/isContains.md
strpos
function can returnint
orfalse
. If you do :Condition is
false
because(bool) 0 === false
.