Ver originalforeach($Campo as $clave => $valor) { $foo = str_replace('{' . $clave . '}', $valor, $foo);}