Ben ne olursa olsun dize uzunluğu, "/" daha önce herhangi bir dize değiştirmek istiyor.
Thanks Jean
tek yönlü, size ilk "/" önce dizesini değiştirmek istiyorum varsayarak.
$str = "anystring/the_rest/blah"; $s = explode("/",$str); $s[0]="new string"; print_r ( implode("/",$s) );
Ben hala preg_replace () tekniği tercih rağmen böyle bir şey, en verimli olacaktır
$pos = strpos($input, '/'); if ($pos >= 0) { $output = $replacement . substr($input, $pos); } else { $output = $input; }