strstr.php
<?php
$email = 'name@example.com';
$aa=str($email,'me');
print_r($aa);
function str($email,$a){
$arr=explode($a, $email);
unset($arr[0]);
return $a.implode($a, $arr);
}
?>
Example #1 strstr() 范例
<?php
$email = 'name@example.com';
$domain = strstr($email, '@');
echo $domain; // 打印 @example.com
$user = strstr($email, '@', true); // 从 PHP 5.3.0 起
echo $user; // 打印 name
?>