字符串替换的问题


Issue with string replace

我做了一个php代码

Array
(
    [0] => 
                                アブソリュート・デュオ>
)

它返回给我这个…

我做了下面的操作来替换空格

$m_name = str_replace(array("'r'n", "'r", "'n"), "", $m_name);
$m_name = trim(mysql_real_escape_string($m_name));
if($m_name!="")
{array_push($m_array,$m_name);}
print_r($m_array);

但是空白的空间似乎仍然存在。我想知道这可能是什么,我该如何替换空白

试着调换这两个函数的顺序:

$m_name = mysql_real_escape_string(trim($m_name));

首先使用trim()函数删除字符串周围的空白。稍后对string

执行其他操作
<?php
//same string asigned to $i
$i=' 
                                    アブソリュート・デュオ>';


//your code     
echo '<pre>';
print_r($i);
echo '</pre>';
//use trim() to remove white space  around the string                               
$i=trim($i);
// now print the result white space removed in $i
echo '<pre>';
print_r($i);
echo '</pre>';
?>