$str = '.$str; echo '
'; echo '
'; ////////////////////////////////////////////// sleep(1); $t = microtime(true); for ($i=0; $i<$max; $i++) { $str2 = str_replace('%%arr'.$i.'%%',$arr[$i],$str2); } $f2 = microtime(true) - $t; echo '$str2 = '.$str2; echo '
'; echo '
'; ////////////////////////////////////////////// sleep(1); $t = microtime(true); $a = explode('%%arr',$str3); for ($i=0, $m=count($a); $i<$m; $i++) { $pos = strpos($a[$i],'%'); $index = substr($a[$i],0,$pos); $a[$i] = $arr[(int)$index].substr($a[$i],$pos+2); } $str3 = join('',$a); $f3 = microtime(true) - $t; echo '$str3 = '.$str3; echo '
'; echo '
'; ////////////////////////////////////////////// sleep(1); $t = microtime(true); for ($i=0; $i<$max; $i++) { $str4 = str_replace('%%arr'.$i.'%%',$arr[$i],$str4); } $f4 = microtime(true) - $t; echo '$str4 = '.$str4; echo '
'; echo '
'; echo ''; echo '

1: '.$f; echo '

2: '.$f2; echo '

3: '.$f3; echo '

4: '.$f4; echo '
'; ?>