$text = "This is a sample text"; $substring = "SAMPLE"; if(stristr($text, $substring)){ echo "Substring found!"; } else { echo "Substring not found."; }
$text = "This is a sample text"; $substring = "notfound"; if(stristr($text, $substring)){ echo "Substring found!"; } else { echo "Substring not found."; }In this example, the function will return false and the output will be "Substring not found." because the string "notfound" is not present in the $text variable. The JString stristr function is part of the Joomla Framework's String library.