在PHP中,查找字符串的方法有以下几种:
$string = 'Hello, World!';
$substring = 'World';
$position = strpos($string, $substring);
echo $position;
$string = 'Hello, World!';
$substring = 'o';
$position = strrpos($string, $substring);
echo $position;
$string = 'Hello, World!';
$substring = 'World';
$result = strstr($string, $substring);
echo $result;
$string = 'Hello, World!';
$substring = 'world';
$result = stristr($string, $substring);
echo $result;
$string = 'Hello, World!';
$substring = substr($string, 7, 5);
echo $substring;