Current Benchmark
<?php
$find = array (
'syridium' => 'ME!',
'test' => 'yep',
'Images' => 'wow',
'hello' => 'syridium developments',
);
$string = $str;
echo strtr($string, $find);
?>
vs.
<?php
$find = array (
'syridium' => 'ME!',
'test' => 'yep',
'Images' => 'wow',
'hello' => 'syridium developments',
);
$string = $str;
foreach($find as $f => $re)
{
$string = str_replace($f, $re, $string);
}
echo $string;
?>
Conclusion
After an average of 3000 cycles, the fastest option is Benchmark 2!
<?php
$find = array (
'syridium' => 'ME!',
'test' => 'yep',
'Images' => 'wow',
'hello' => 'syridium developments',
);
$string = $str;
foreach($find as $f => $re)
{
$string = str_replace($f, $re, $string);
}
echo $string;
?>