【发布时间】:2013-12-18 20:36:33
【问题描述】:
这是我的代码:
$entusername = "why,always,me";
$entusername = str_replace(' ', '', $entusername);
$sortusernames = split(',',$entusername);
foreach ($sortusernames as $eachuser){
echo "$eachuser<br>";
}
此代码返回以下内容:
为什么总是我
但是我试图让它像这样回显:
为什么
总是
我
我哪里错了? 谢谢。
【问题讨论】:
-
工作正常:phpfiddle.org/main/code/8v7-eqp。顺便说一句,使用
explode而不是split,split自 PHP '5.3.0' 起已弃用。 -
检查你的源代码也许可以确定你的脚本的输出