문자열에 단어가 포함되어 있는지 php 확인
$myString = 'Hello Bob how are you?';
if (strpos($myString, 'Bob') !== false) {
echo "My string contains Bob";
}
php 문자열 포함
$mystring = 'abc';
$findme = 'a';
$pos = strpos($mystring, $findme);
문자열이 포함 된 경우 php 찾기
if (strpos($string, 'substring') !== false) {
// do stuff
}
php 바늘 건초 더미
//Find the position of the first occurrence of a substring in a string
$mystring = 'abc';
$findme = 'a';
$pos = strpos($mystring, $findme);
php 의 strpos
<?php
// We can search for the character, ignoring anything before the offset
$newstring = 'abcdef abcdef';
$pos = strpos($newstring, 'a', 1); // $pos = 7, not 0
?>