public static function startsWith(string $searchString, string $prefix): bool
    {
        if (empty($searchString) || empty($prefix)) {
            return false;
        }
        
        $startStringLen = strlen($prefix);
        if (strlen($searchString) < $startStringLen) {
            return false;
        }
        
        $possibleStartStringInSearch = substr($searchString, 0, $startStringLen);
        return (strcmp($possibleStartStringInSearch, $prefix) === 0);
    }
public static function startsWith(string $searchString, string $prefix): bool
    {
        if (empty($searchString) || empty($prefix)) {
            return false;
        }
        
        $startStringLen = strlen($prefix);
        if (strlen($searchString) < $startStringLen) {
            return false;
        }
        
        $possibleStartStringInSearch = substr($searchString, 0, $startStringLen);
        return (strcmp($possibleStartStringInSearch, $prefix) === 0);
    }
public static function startsWith ( string $ searchString , string $ prefix ) : bool { if ( empty ( $ searchString ) || empty ( $ prefix ) ) { return false ; } $ startStringLen = strlen ( $ prefix ) ; if ( strlen ( $ searchString ) < $ startStringLen ) { return false ; } $ possibleStartStringInSearch = substr ( $ searchString , 0 , $ startStringLen ) ; return ( strcmp ( $ possibleStartStringInSearch , $ prefix ) === 0 ) ; }
Check if a string starts with a prefix.

@param string $searchString
The string to check.

@param string $prefix
The prefix to find.

@return bool Whether the string starts with the prefix.
Check if a string starts with a prefix .