In code, you often have to use functions:
echo; and
print; Which of the functions is heavier and heavier than the server?
In code, you often have to use functions:
echo; and
print; Which of the functions is heavier and heavier than the server?
Indeed, we see that print may turn out to be a little slower than echo (or it may not be that the results of the first two methods demonstrate). At the same time, using echo with several parameters instead of concatenation (and single quotes instead of double quotes) gives a very noticeable performance gain.
Repeated execution $ t0 = microtime (true); for ($ i = 0; $ i <10000; $ i ++) {echo "sdfsdfsdfsrn"; } echo microtime (true) - $ t0;
and
$t0 = microtime(true); for($i=0; $i<10000; $i++){ print "sdfsdfsdfs\r\n"; } echo microtime(true) - $t0; Did not give visible gains of one or another option.
Personal withdrawal; The speed is not in this. Often, everything is adjusted to work with data. Arrays files sockets, etc.
Most of the server load functions written by coders, who still do not know that saving on matches and premature optimization is the root of all evil.
And yes, the OUT instruction will work the fastest.
echo is much faster than print . echo does not return any data, unlike print
About double and single quotes in PHP read here.
Everybody makes conclusions for himself
You can also read here
And even better not as @AlexWindHope wrote
echo 'привет ' . $name; And so:
echo 'привет ' , $name; Because will be even faster, it is also in the article proposed by @Damon
Well for the "unbelievers" spent tysty! The output of 2 variables on the screen through the gap. The number of output operations per one run is 10 thousand., The number of runs is 50, the average time for all half a million operations. Screen: image external link 
A single quote is not only faster, but also more convenient with html, then with an example:
echo "<a href=\"link.html\">Link</a>"; echo '<a href="link.html">Link</a>'; Source: https://ru.stackoverflow.com/questions/36047/
All Articles