728x90
반응형
설명
strpos(string $haystack, string $needle, int $offset = 0): int|false
(PHP 4, PHP 5, PHP 7, PHP 8)
strpos — 문자열에서 하위 문자열이 처음 나타나는 위치를 찾음
출처
PHP: strpos - Manual
A pair of functions to replace every nth occurrence of a string with another string, starting at any position in the haystack. The first works on a string and the second works on a single-level array of strings, treating it as a single string for replaceme
www.php.net
소스
$string = 'hello Fubao';
$search = "Fubao";
if(strpos($string, $search) !== false)
echo "존재합니다";
else
echo "존재하지 않습니다";
728x90
반응형
'IT > PHP | CI' 카테고리의 다른 글
[PHP/CodeIgniter] ZOOM API 연동하기 (sever-to-sever OAuth) - 2 (0) | 2023.10.13 |
---|---|
[PHP/CodeIgniter] ZOOM API 연동하기 (sever-to-sever OAuth) - 1 (0) | 2023.09.27 |
[CodeIgniter] db 에러(error) 시 멈춤 무시하기 (0) | 2023.08.02 |
[CodeIgniter/PHP] checkbox 배열 데이터 가공해서 SQL IN절에 넣기 (0) | 2023.06.01 |
PHP 시큐어코딩 (0) | 2023.05.21 |