How can one make only certain parts of a string replaceable in PHP?

To make only certain parts of a string replaceable in PHP, you can use the `str_replace` function with an array of search and replace values. This allows you to specify which parts of the string you want to replace while leaving other parts unchanged.

$string = "Hello {name}, welcome to {place}!";
$replacements = array(
    '{name}' => 'John',
    '{place}' => 'Paris'
);

$newString = str_replace(array_keys($replacements), array_values($replacements), $string);

echo $newString;