<?php
function isSubstring($string, $substring)
{
return strpos($string, $substring) !== false;
}
// Usage example:
$mainString = "Hello, World!";
$substring = "World";
if (isSubstring($mainString, $substring)) {
echo "The substring '$substring' is found in the main string.";
} else {
echo "The substring '$substring' is not found in the main string.";
}
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter