2 ms·
php has not been "mix html & code" for the last 10 years if you use it properly
by Oxodao 1y ago
php has not been "mix html & code" for the last 10 years if you use it properly
- ZYbCRq22HbJ2y7 1y agoYou mean that the general patterns that people implement when using PHP changed. The language hasn't changed in a fundamental way that prevents it from being utilized in this way.
- Oxodao 1y agoYes
- ipaddr 1y agoNo it's still proper to mix html and php code. You could always use a templating language like smarty 20 years ago so if it wasn't proper 10 years ago it wasn't proper 20 years ago. The truth is <=$variable?> is very readable.
- Oxodao 1y agoThe issue is not the readability, it's that you don't handle how your stuff is sent. Using php as a template language, it starts to send everything until it reaches a Php tag to be executed. That's why people taught each other that "you absolutely need to make session_start at the beggining of your file". No you don't, but since afterward the content starts to be sent the headers are already too. I'm not saying you absolutely need to use a framework, but you should have only one echo in your requests. I've never said the syntax you're saying is bad, I mean pretty much any templating language such has Twig uses this kind of stuff. The issue I have with this is how it works behind the scenes