3 ms·
> PHP persists because it has a strong foothold, not because it is clearly a more secure and enjoyable language. It is still immensely satisfying to write in a
by maratd 14y ago
> PHP persists because it has a strong foothold, not because it is clearly a more secure and enjoyable language.
It is still immensely satisfying to write in any text editor <?php echo (2 + 2); ?> and then see 4 on your screen. And then to wrap that in HTML and really get going. No compiling, no libraries to include, that's it. After writing code in Java and C (12 years ago), that is a breath of fresh air, and that's what got developers of my generation interested in PHP.
Do you have more options today? Absolutely. Python and Ruby were extremely obscure back then. No longer. You have Node.JS and of course, good templating libraries for all of the above.
But PHP is a templating language at heart and it's still the easiest to embed into HTML and see immediate results. That's pure joy.
Funny part? None of my production PHP code touches HTML or any client side stuff in any way. It just pumps data from the database to the client-side JavaScript.
And it's still immensely enjoyable. Why? Because PHP is aimed at the lowest common denominator. It has to work for that dude in India and it has to work for the 50 year old guy who just decided to switch careers. Which means the base language has to be dead simple. And it is. It's pretty much C with a few web-centric functions thrown in. That simplicity is enjoyable.
- modarts 14y agoI'm sure it's all fun and enjoyment while you're writing the code; but what about going back 2-3 months later, or worse, hiring additional developers on the project? How enjoyable is it to have reams of inline server script across multiple pages with no clear structure or intent?
- danso 14y agoThanks for the answer. I agree with the ease part. And not touching the HTML, if that's how the app is arranged, is also good...I think my worst memories involved maintaining PHP that I (not knowing better) just threw into HTML when it seemed right.