PHP 文字列内の一連の短いタグを置き換える最良の方法は何ですか。例:
$return = "Hello %name%, thank you for your interest in the %product_name%. %representative_name% will contact you shortly!";
%name% は、次のような配列またはオブジェクトからの特定の文字列であると定義します。
$object->name;
$object->product_name;
等..
文字列に対して str_replace を複数回実行できることはわかっていますが、それを行うためのより良い方法があるかどうか疑問に思っていました。
ありがとう。