Hi this is a basic question, however I'm not sure about it, so I ask you:
If I have more than 100 php echos in my html code, something like this:
file.php:
<!-- headers -->
<h1><?php echo $text1; ?></h1>
<p><?php echo $text20; ?></p>
<p><?php echo $text10; ?></p>
<!-- more code -->
Should I use output buffering ? If so, which would be the right way (or function) to 'show' the output ?
Thanks in advance !
Output buffering is ideal for one primary reason, and it's not to reduce the number of echos. It is ideal because it allows you to write a cache file and serve up that static cache file when it is requested. Then your PHP never outputs directly to the browser, it always writes to files when are then loaded and displayed to the browser. Assuming you set your cache expire headers to a reasonable duration, this will improve performance much more than worrying about "how" you output your data.
Typical case: