我似乎遇到了字符串替换问题
$vals= "1/5/2012 $4,510.64
"; //simulating web entry that would be copied and pasted from excel.
$vals = str_replace(array("\t"), " ", $vals);
echo $vals;
1/5/2012 $ 4,510.64 13257216001415138792
修剪相同
$vals= "1/5/2012 $4,510.64
";
$vals=trim(preg_replace('/\t+/', ' ', $vals));
echo $vals;
1/5/2012 $ 4,510.641325721600
但是如果我告诉它不要用空格替换制表符,而是删除它们,那么它就不会添加任何垃圾。
$vals= "1/5/2012 $4,510.64
";
$vals=trim(preg_replace('/\t+/', '', $vals));
echo $vals;
1/5/2012 $ 4,510.64
一点帮助?我希望标签可以替换为空格,而不会在最后添加随机数字。感谢