vsprintf or sprintf with named arguments, or simple template parsing in PHP
Late to the party, but you can simply use strtr to “translate characters or replace substrings” <?php $hours = 2; $minutes = 24; $seconds = 35; // Option 1: Replacing %variable echo strtr( ‘Last time logged in was %hours hours, %minutes minutes, %seconds seconds ago’, [ ‘%hours’ => $hours, ‘%minutes’ => $minutes, ‘%seconds’ => $seconds … Read more