Are there any best practices for efficiently replacing multiple placeholders in a text with variables in PHP?

When replacing multiple placeholders in a text with variables in PHP, one efficient approach is to use the `str_replace()` function in combination with arrays. Create an array of placeholders and an array of corresponding variables, then use `str_replace()` to replace each placeholder with its respective variable in the text.

$text = "Hello, [name]! Your [item] is ready for pickup.";
$placeholders = ['[name]', '[item]'];
$variables = ['John', 'order'];

$newText = str_replace($placeholders, $variables, $text);

echo $newText;