PHP str_starts_with()

Jmnote (토론 | 기여)님의 2023년 3월 12일 (일) 18:03 판 (→‎개요)

1 개요

PHP str_starts_with()
PHP
Copy
<?php
if (str_starts_with('abc', '')) {
    echo "모든 문자열은 빈 문자열로 시작한다";
}
Loading
PHP
Copy
<?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"를 찾을 수 없다';
}
Loading

2 같이 보기

3 참고