$string = "Hello world!"; $subString = "Hello"; if (t3lib_div::isFirstPartOfStr($subString, $string)) { echo "The string starts with the subString"; } else { echo "The string does not start with the subString"; }
$url = "https://www.example.com"; if (t3lib_div::isFirstPartOfStr("https://", $url)) { echo "The URL is secure"; } else { echo "The URL is not secure"; }This code will output "The URL is secure" as the $url variable starts with "https://". These examples use the t3lib_div function from the TYPO3 Core API library.