It checks if the given substring contains a given string. If the substring mentioned will be present in the string then it will return True otherwise it will return False.
<?php
if(str_contains("abc", "a")) {
echo 'Found';
}
str_contains("abc", "d"); // false
str_contains()
function is case-sensitive. There is no case-insensitive variant of this function.
str_contains()
function always returns a boolean value.
str_contains()
function will return TRUE in case of checking for the substring ("")
as empty.
<?php
str_contains('Foo', ''); // true
str_contains('', ''); // true