string strstr ( string $haystack , mixed $needle [, bool $before_needle = false ] ),查找字符串的首次出现,返回 haystack 字符串从 needle 第一次出现的位置开始到 haystack 结尾的字符串,如果找不到则返回false。该函数区分大小写,如果不想区分大小写,可以用stristr()
<?php
$email='name@example.com';
$domain=strstr($email,'@');
echo $domain; //打印@example.com
$user=strstr($email,'@',true);//从php5.3.0起
echo $user;//打印name
随时随地看视频