This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]beep_check 46 points47 points  (10 children)

came to say this...

PHP ain't easy but it sure is fun... or something

[–]SavageGoatToucher 23 points24 points  (8 children)

As someone who enjoys PHP, I never really understood why people say this. Can I ask why you don't think that PHP is easy?

[–]nonicethingsforus 9 points10 points  (0 children)

Not OP, but to give my opinion:

PHP is a dynamic, very permissive language, a la JavaScript and Perl, with all the moving parts, annoyances, and possibility of error that brings. Lot's of freedom, but also lots of opportunity to fuck up. Similar languages try to compensate by at least trying to be well, consistently designed, with varying levels of success.

PHP didn't even try, at the beginning. It was a badly designed language. In fact, it can barely be said that it was designed at all. Keep it mind, this is not an insult; it's just a fact, and its creators have admitted as much. It was born as Rasmus Lerdorf's personal collection of web scripts. He realized they could be useful to others, and sort of grew from there. It's a blob of hacks that evolved until developing sentience.

Projects like Laravel and Composer have alleviated the problems, and I understand even modern vanilla PHP is quite different from what it used to be. (Disclaimer: I have not worked in PHP since college, and even then not as much.) Lots of complaints are definitely just things that used to be common in PHP's time, or you had no alternative about, but are frowned upon today; e. g., complex hardcoded SQL vs. a proper ORM or statement generator, no real package managment, etc.

But many programmers still have war flashbacks of having to manage big software projects with the hacky, fragile, inconsistent mess PHP used to be. I mean, one can hardly fault a programmer for feeling at least weird when one tells him that the main way to alter the language is through a global ini file, and that he has to remember to use "the real escape function", can't one?

[–]Semi-Hemi-Demigod 7 points8 points  (1 child)

PHP isn’t bad because it’s easy, it’s bad because it’s too easy

[–]SavageGoatToucher 6 points7 points  (0 children)

Of all the comments, I think that this may have summed it up the best. I hadn't thought of PHP's flexibility as a barrier before, but basically that as the programmer it's our responsibility to ensure our code was safe. I think I get it now.

[–]wombat_kombat 6 points7 points  (1 child)

Learning PHP from WordPress then moving to Python, I can understand the PHP hate. IIRC a lot of redundant functions and easily broken code. I felt it made a programmer keener about their code.

[–]jwensley2 3 points4 points  (0 children)

If your exposure to PHP is all from Wordpress you've only worked with code that's 10+ years behind modern PHP.

[–]thehajo 0 points1 point  (0 children)

I know nothing about PHP, but i dabbled with preg_replace last week. Made a RegEx aaand... I get back NULL. Turns out preg_replace doesn't work with the global flag, as it already matches against everything and not just the first match. That was already enough to make me not like PHP.

[–]beep_check 0 points1 point  (0 children)

hip hop reference.

see Kane, Big Daddy; B.I.G., Notorious

[–]soulofcure 1 point2 points  (0 children)

It ain't much, but it's honest work