\\.\;1283177 wrote:Don't forget the sprintf function, this can also help with string formatting
$title = sprintf( "About %s, %s USA", $lang['city'], $lang['stateabb']);
+1
And when it gets at all complex, you can break everything into separate lines:
$text = sprintf(
"blah blah blah %s blah blah %f blah blah blah %s.",
preg_replace('/\s+/', ' ', $foo['bar'],
$foo['total'] / $foo['num_entries'],
date('Y-m-d', $foo['date'])
);
...which keeps things pretty compact while still being pretty readable (and maintainable).