PHP 5.5.8 Released
php.net
php.net
"This release fixes about 20 bugs against PHP 5.5.7 components."
Of the few things PHP should be great at, parsing and generating html markup is close to the top of the list. Yet DOMDocument has given me so many headaches...
Is there any good book or other resource which describes modern PHP with best practices, parts to avoid, etc?
It's a great intro on how to write sphagetti code with out losing face.
I believe that programmers ability to write poor code is quite language agnostic.
PHP was suitable for new programmers because of how easy it is to deploy, learn. PHP3, the first version of PHP which was widespread, was released during the dot com bubble. When everyone and their mums was into Web. Everyone started writing tutorials, passing their shitty skill set. to new developers. Which produced more crap developers.
The big problem with PHP is that it grew to popularity as it grew into a turing-complete templating language, and the major paradigm for it was more or less the idea that documents are programs. That actually encouraged mixture of logic and presentation concerns.
There are some other warts possibly worth railing at, but that's really the main place it gets its probably deserved reputation for having more spaghetti code, even though pros working in have long since moved on from that paradigm.
FWIW, this is also its strength: it's a very short distance with a gentle curve from authoring documents to authoring dynamic documents. I don't think anything else matches it.
Of course, the curve from there to a larger application, that can be a different story, depending on what kind of guidance one has (and most likely, without guidance, ontology will recapitulate philology, as they say).
I recently moved from CodeIgniter 2.x over to Laravel, and it was like breathing fresh new air at the top of a mountain. Everything is cutting edge, organized, and fun to code again. Sounds like hyperbole, but for real it reinvigorated my programming efforts.
Check it out here: http://laravel.com/
Namespace convention sucks. That is all.
That is modern PHP done right.
It can (and has been) argued that PHP is itself a templating language and that the added abstraction of something like Twig is unnecessary... while that's technically true, scaling that gets you trainwrecks like Wordpress' API, where it's all but impossible to write plugins without mixing html in with the code. You also get nice things like macros, auto-escaping, and caching with a template engine, and you would probably end up having to reimplement a lot of that at some point anyway.
Although what Laravel uses (blade) for templating looks pretty close to bare PHP, so there's plenty of room for minimal abstraction.
But all of it is light-years ahead of the nightmare that is typical legacy PHP.
I think this is the worst symptom: Sure, you can write snappy code that performs fast but when you try to reach a higher abstraction level, all those fundamental design failures catch up and make everything awkward and just bad.
1. PHP supports goto since version 5.3.0; people speculated that term "troll driven development" in announcement was not a joke.
2. $ variable prefix in Perl was a joke about Hungarian notation and first BASIC dialects. PHP take that joke seriously.
I can understand the case for Python, but Javascript gets almost as much hate as PHP, and for many similar reasons.
And anyway, logically that suggests the core problem with PHP lies within C, if PHP is just a wrapper. Would you also say C is useless, or not worth taking seriously?
[edit]Which is not to say I don't agree with the "PHP is garbage" comments. I just also agree with the "seriously, we read all of this the last three thousand times PHP articles were posted, please shut up" snark.[/edit]
* complaints about features it has or has not
* a reference to that "a fractal of bad design" article
* how language x is better
* sarcastic, ironic or post-ironic notes about the above
* one guy pointing out we can't have anything involving PHP without the above
I've seriously started using it as a unit of measurement for the level of knee-jerk anti-PHP fanaticism present in a thread.