这是一个非常新手的问题,但我就是不知道问题出在哪里,所以请多多包涵...
这就是我想要实现的目标-->$new = 'OMG_This_Is_A_One_Stupid_Error';
这是我从这段代码中得到的——>$new = 'OMG This Is A One Stupid_Error';
<?php
$find = 'OMG This Is A One Stupid Error'; //just an example
$offset = 0;
$search = ' ';
$length = strlen($search);
$replace = '_';
while($substring = strpos($find, $search,$offset))
{
$new = substr_replace($find, $replace,$substring,$length);
$offset = $substring + $search_length;
}
echo $new;
?>