I have been taught about embedding PHP inside HTML OR HTML inside PHP. I would like to start writing some apps in PHP and would like to know from you guys which one of the options to use.
At the moment i don’t know which option to use so i decided to ask for some advice. It may be that one is better than the other in general.
I am about to develop real-world applications so i want to know which one to use. May be it may affect my future colleagues etc…
It may also be that the open source community and PHP programmers in general have a tradition of using one option.
Which one is mostly used in real-world applications?
Just need some advice.
Thank you.
My advice is to stick a bit with vanilla PHP [vars, operators, loops, conditions, core functions], then pick a framework [Symfony, Zend Framework, YII, Codeigniter]and follow its conventions and principles.
About PHP vs HTML, the idea is to keep business and presentational logic separated, i.e. you should gather all the stuff you need to display in a piece of your code, then in another section you write the HTML using as little PHP as you can [just for echoing values or performing loops for table population, etc.].
Then you’ll get into topic such as templates, Model-View-Controller architecture…but don’t go further now.