几行源代码,报错,可我怎么也没看出有什么错误

WBOY
Release: 2016-06-23 13:40:37
Original
1112 people have browsed it

报错:
( ! ) Deprecated: Function split() is deprecated in D:\wamp\www\my\ereg.php on line 3
Call Stack
# Time Memory Function Location
1 0.0000 140880 {main}( ) ..\ereg.php:0

源代码:

$email = "9282281@qq.com";
$arr = split('@|\.', $email);

while (list($key,$values) = each($arr)) {
echo $values.'
';
}
?>


回复讨论(解决方案)

Deprecated 中文释义:不推荐使用
split 函数已在废止之列,建议不要使用

那应该用哪一个函数?

 preg_split() 用它 替代

$arr = preg_split('/@|\./', $email);
Copy after login


那应该用哪一个函数?

这种情况我一般是把@换成. 当然倒过来也一样
然后用explode拆
能避开正则引擎尽量不用

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template