Use sprintf instead of variables contained in double quotes, it’s about 10x faster.
<?php
$num = 5;
$location = 'tree';
$format = 'There are %d monkeys in the %s';
echo sprintf($format, $num, $location);
?>
Source: http://php.net/manual/en/function.sprintf.php
<?php
$num = 5;
$location = 'tree';
$format = 'There are %d monkeys in the %s';
echo sprintf($format, $num, $location);
?>
Source: http://php.net/manual/en/function.sprintf.php
No comments:
Post a Comment