After recently having to work with modern PHP, I have to say a lot of the criticism of the language is unfounded. It's changed a lot since I first used it. But the stdlib is still hard to manage. Different naming conventions, different order on the parameters for functions that do almost the same thing, and every function is global. Couldn't they keep all that for backwards compatibility, but create more sane wrapper…
Fun with PHP: $a = 'b'; $b = 'a'; echo $a."\n"; >>> b echo $$a."\n"; >>> a echo $$$a."\n"; >>> b Yaaa $obj = new StdClass(); $obj->x = 1; function x_plus_one($obj) { $obj->x++; } x_plus_one($obj); var_dump($obj); >>> object(stdClass)#1 (1) { >>> ["x"]=> >>> int(2) >>> } Huh? A local change to the object changed the object outside the local scope? It must have been passed by reference... function null_the_object($obj)…
Announcing a specification for PHP
81–90 of 263 posts
Re: Announcing a specification for PHP
#82Earlier quoted context omitted.
Nikita proposes methods on primitive types: http://nikic.github.io/2014/03/14/Methods-on-primitive-types... Myself, I like this proposal.
Soon all dynamic languages will be one. Except for the method call syntax.
And it doesn't make a language 'dynamic'. The language I found with UFCS is both static and compiled.
Re: Announcing a specification for PHP
#83After recently having to work with modern PHP, I have to say a lot of the criticism of the language is unfounded. It's changed a lot since I first used it. But the stdlib is still hard to manage. Different naming conventions, different order on the parameters for functions that do almost the same thing, and every function is global. Couldn't they keep all that for backwards compatibility, but create more sane wrapper…
Have any good examples? I haven't used the language in years, would love to see what "modern" PHP looks like. (Seriously, not trolling at all)
Re: Announcing a specification for PHP
#84Re: Announcing a specification for PHP
#85After recently having to work with modern PHP, I have to say a lot of the criticism of the language is unfounded. It's changed a lot since I first used it. But the stdlib is still hard to manage. Different naming conventions, different order on the parameters for functions that do almost the same thing, and every function is global. Couldn't they keep all that for backwards compatibility, but create more sane wrapper…
> It's changed a lot since I first used it. Have any good examples? I haven't used the language in years, would love to see what "modern" PHP looks like. (Seriously, not trolling at all)
I just came back to PHP myself after 4 years away and have been pleasantly surprised. A lot of it has been community driven with things like the PHP-PSR standards and Composer, in additional to all the language features that have hit since 5.3
Re: Announcing a specification for PHP
#86I'm not really a fan of having a second source of truth compared to in depth material already on php.net. The two will invariably start to disagree and php.net is much, much better than any spec or documentation I have ever read. Using Android is a nightmare compared to php.net because every single thing on php.net has extensive user generated documentation whereas Android is just some broken official docs. I submitt…
Think of it as what the ECMA spec is to the Node.js API docs. Rarely does a user writing JS code using Node need to reference the ECMA spec (though they should by all means be familiar with it!) but they almost certainly have the API docs bookmarked.
Re: Announcing a specification for PHP
#87Earlier quoted context omitted.
Fun with PHP: $a = 'b'; $b = 'a'; echo $a."\n"; >>> b echo $$a."\n"; >>> a echo $$$a."\n"; >>> b Yaaa $obj = new StdClass(); $obj->x = 1; function x_plus_one($obj) { $obj->x++; } x_plus_one($obj); var_dump($obj); >>> object(stdClass)#1 (1) { >>> ["x"]=> >>> int(2) >>> } Huh? A local change to the object changed the object outside the local scope? It must have been passed by reference... function null_the_object($obj)…
To be fair, all languages are "a bit quirky". It gets worse when you start including things that are in the PHP stdlib but aren't in other languages by default. [e.g. When they basically re-implement how php-fpm handles requests and thread safety]
Agreed. These are just a few quirks in PHP I find amusing.
Re: Announcing a specification for PHP
#88Earlier quoted context omitted.
To be fair, all languages are "a bit quirky". It gets worse when you start including things that are in the PHP stdlib but aren't in other languages by default. [e.g. When they basically re-implement how php-fpm handles requests and thread safety]
>>> To be fair, all languages are "a bit quirky". Agreed. These are just a few quirks in PHP I find amusing.
Re: Announcing a specification for PHP
#89After recently having to work with modern PHP, I have to say a lot of the criticism of the language is unfounded. It's changed a lot since I first used it. But the stdlib is still hard to manage. Different naming conventions, different order on the parameters for functions that do almost the same thing, and every function is global. Couldn't they keep all that for backwards compatibility, but create more sane wrapper…
Fun with PHP: $a = 'b'; $b = 'a'; echo $a."\n"; >>> b echo $$a."\n"; >>> a echo $$$a."\n"; >>> b Yaaa $obj = new StdClass(); $obj->x = 1; function x_plus_one($obj) { $obj->x++; } x_plus_one($obj); var_dump($obj); >>> object(stdClass)#1 (1) { >>> ["x"]=> >>> int(2) >>> } Huh? A local change to the object changed the object outside the local scope? It must have been passed by reference... function null_the_object($obj)…
Re: Announcing a specification for PHP
#90This is great news for the PHP community, and I for one applaud their effort. Contrary to what many HN hipsters seems to believe, PHP is quite a capable language, and HHVM / Hack is really pushing things forward. * Hack introduces type hinting, imo the major lacking part in PHP. * HHVM introduces speed to php. On a personal project calculating perlin noise, I got about 8x speedup on HHVM. * The specification helps pa…
I don't think many would claim that PHP isn't capable. It's that some of us just don't enjoy it and find it to ugly. Especially given how mature competing languages have become.