PHP str_starts_with()

1 개요[ | ]

PHP str_starts_with()
<?php
$str = 'To be, or not to be, that is the question.';
var_dump(str_starts_with($str, 'To be'));
var_dump(str_starts_with($str, 'not to be'));
<?php
if (str_starts_with('abc', '')) {
    echo "모든 문자열은 빈 문자열로 시작한다";
}
<?php
$string = 'The lazy fox jumped over the fence';

if (str_starts_with($string, 'The')) {
    echo "문자열이 'The'로 시작한다\n";
}

if (str_starts_with($string, 'the')) {
    echo '문자열이 "the"로 시작한다';
} else {
    echo '대소문자가 맞지 않아서 "the"를 찾을 수 없다';
}

2 같이 보기[ | ]

3 참고[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}