Which would be the prefered choice in replacing a string (performance wise):
1.
if ($str = 'first'){
$str = 'Homer';
{
elseif ($str = 'last'){
$str = 'Simpson';
elseif ($str = 'middle'){
$str = 'J';
}
OR
2.
$str = str_replace('first', 'Homer', $str);
$str = str_replace('last', 'Simpson', $str);
$str = str_replace('middle', 'J', $str);