I’m very new in php. So i realize from my first steps is this language that we have the opporunity to combine or not php code and html code. Could anyone answer to me, which is the most appropriate way:To combine html and php code or to keep them seperately?and why?
Share
Combining PHP and HTML is always a bad idea (edit: of course as long as you are mixing data, logic and presentation, as you are going to do…) and an headache for future developers of your application. But, as you’ve just started learning PHP, i would suggest “separating” code blocks from HTML as much as you can, like this:
Then go more in deep trying a template engine like Twig or Smarty.