yii\helpers\BaseStringHelper::startsWith PHP Method

startsWith() public static method

Binary and multibyte safe.
public static startsWith ( string $string, string $with, boolean $caseSensitive = true ) : boolean
$string string Input string
$with string Part to search inside the $string
$caseSensitive boolean Case sensitive search. Default is true. When case sensitive is enabled, $with must exactly match the starting of the string in order to get a true value.
return boolean Returns true if first input starts with second input, false otherwise
    public static function startsWith($string, $with, $caseSensitive = true)
    {
        if (!($bytes = static::byteLength($with))) {
            return true;
        }
        if ($caseSensitive) {
            return strncmp($string, $with, $bytes) === 0;
        } else {
            return mb_strtolower(mb_substr($string, 0, $bytes, '8bit'), Yii::$app->charset) === mb_strtolower($with, Yii::$app->charset);
        }
    }