I also find it funny that people who hate on PHP used to hate on JavaScript for many of the same reasons and they now have an unhealthy, public love affair with it. That and people who tried jamming WordPress or some CMS into every use-case 10 years ago are commenting on how they don't like PHP. IMO, PHP has kept it's charm but added a lot of good stuff from other languages like Java. PHP is the language of choice and getting shit done. Oh, and not having to worry about lack of work.
I also find it funny that people who hate on PHP used to hate on JavaScript for many of the same reasons and they now have an unhealthy, public love affair with it.
Javascript used to be clunky due to cross-browser issues. These are mostly resolved now (at the language level).
PHP, on the other hand, has always been clunky. For example, it's often said that parsing is a solved problem. Try telling that to PHP:
$y = new stdClass;
$y->foo = function() { echo "World"; };
$y->foo(); // "No such method 'foo'"??!
I've written quite a few parsers, but still have no idea how PHP's could end up like this. Here are some recent 'features' from PHP 5.4 and 5.5 which every other parser on the planet would have handled from day 1:
- Passing an arbitrary expression instead of a variable to empty() is now supported. (PHP 5.5)
- Function array dereferencing has been added, e.g. foo()[0]. (PHP 5.4)
- Class member access on instantiation has been added, e.g. (new Foo)->bar(). (PHP 5.4)
I've written quite a few parsers, but still have no idea how PHP's could end up like this.
Have you ever tried to parse code with a set of context sensitive rules (like, not using yacc, but writting your parser case by case at hand) and context free regular expression (don't use look ahead at all, and you also can't look behind)? PHP errors look a lot like this.
I also find it funny that people who hate on PHP used to hate on JavaScript for many of the same reasons and they now have an unhealthy, public love affair with it.
I think JQuery and Coffeescript, have gone a long way to mollify people's opinions about javascript in a similar way to frameworks in PHP. And compared to PHP, some of javascript's syntax (particularly arrays, objects and anonymous functions) are a lot easier to deal with than in PHP, so there's some appreciation of that in the Node community, no doubt. But yeah, it does seem as if PHP and javascript are sort of the black sheep of the web app world.
Comments
I also find it funny that people who hate on PHP used to hate on JavaScript for many of the same reasons and they now have an unhealthy, public love affair with it. That and people who tried jamming WordPress or some CMS into every use-case 10 years ago are commenting on how they don't like PHP. IMO, PHP has kept it's charm but added a lot of good stuff from other languages like Java. PHP is the language of choice and getting shit done. Oh, and not having to worry about lack of work.
Javascript used to be clunky due to cross-browser issues. These are mostly resolved now (at the language level).
PHP, on the other hand, has always been clunky. For example, it's often said that parsing is a solved problem. Try telling that to PHP:
$x = function() { return function() { echo "Hello"; }; }; $x()(); // Syntax error??!
$y = new stdClass; $y->foo = function() { echo "World"; }; $y->foo(); // "No such method 'foo'"??!
I've written quite a few parsers, but still have no idea how PHP's could end up like this. Here are some recent 'features' from PHP 5.4 and 5.5 which every other parser on the planet would have handled from day 1: - Passing an arbitrary expression instead of a variable to empty() is now supported. (PHP 5.5) - Function array dereferencing has been added, e.g. foo()[0]. (PHP 5.4) - Class member access on instantiation has been added, e.g. (new Foo)->bar(). (PHP 5.4)
Have you ever tried to parse code with a set of context sensitive rules (like, not using yacc, but writting your parser case by case at hand) and context free regular expression (don't use look ahead at all, and you also can't look behind)? PHP errors look a lot like this.
I think JQuery and Coffeescript, have gone a long way to mollify people's opinions about javascript in a similar way to frameworks in PHP. And compared to PHP, some of javascript's syntax (particularly arrays, objects and anonymous functions) are a lot easier to deal with than in PHP, so there's some appreciation of that in the Node community, no doubt. But yeah, it does seem as if PHP and javascript are sort of the black sheep of the web app world.