3 ms·
Anyone still hating on PHP in 2015 is doing it wrong.
by ceejayoz 12y ago
Anyone still hating on PHP in 2015 is doing it wrong.
- sneak 12y agoSaying "it's the wrong tool for the job" and hating on it are two different things.
- ceejayoz 12y agoAnd you said anyone using PHP in 2015 is doing it wrong, which given that you don't know what "the job" someone might be using it for, seems to head over to the "hating on it" territory. PHP in 2015 means great frameworks like Symfony/Laravel, high performance with HHVM (and soon PHP7), good package management with Composer, etc. It has made great strides.
- juliangregorian 12y agoIt's playing catch-up, and it's severely hampered by its refusal to break backwards compatibility for anything. I did a PHP contract last year after not having done PHP in years. I had genuinely high hopes for it because of having seen sentiments like yours. And Symfony is a pretty okay framework (but not great), Composer is decent, and HHVM is a pretty fast VM. But the language itself has fundamentally not changed at all -- it's still flawed in deep ways, while the developers seem mainly preoccupied with adding as many features from Java as they can. In 2015, I see someone defending PHP and I think they simply don't know any other language.
- imakesnowflakes 12y agoNo. http://www.reddit.com/r/PHP/comments/2zhg6z/how_true_is_this_php_bashing/cpjhx04 http://www.reddit.com/r/PHP/comments/2zhg6z/how_true_is_this... Read that and tell me that it is Ok..And see how that comment has been downvoted. That is PHP community for you. In 2015.
- ceejayoz 12y agoA single downvote on a subreddit is indicative of the PHP community as a whole? Well, shit, time to ditch the language... Why would you think the third value in ['ab', 'cd', '10', 'gh', '24'] would have a key of '10'? That's the value, not the key. The docs are quite clear on how this works: http://php.net/manual/en/control-structures.foreach.php http://php.net/manual/en/control-structures.foreach.php foreach (array_expression as $value) vs. foreach (array_expression as $key => $value)
- imakesnowflakes 12y ago>Why would you think the third value in ['ab', 'cd', '10', 'gh', '24'] would have a key of '10'? That's the value, not the key. Can you please take one more look? Values in the first array is used as keys to set values in the second array..
- juliangregorian 12y agoYou've misunderstood. He only uses that (flat) array to populate the key-value array $c. His problem is that PHP oh-so-helpfully converts the string value to an int value. It's actually impossible to have string values as indices of an array when they are parsable as numbers in PHP. One of the many foibles that stem from conflating flat arrays and key-value maps. (For a real fun time, try reading the docs for array_merge.) Anyway, it's not surprising. /r/PHP doesn't handle criticism well.
- joesmo 12y agoIt is ok. That's how the language is designed so that arrays cover both hash-map use cases and traditional numerically indexed array use cases. The behavior is well documented and in this specific example, using a == instead of a === would cause the desired result. The poster of that comment should RTFM.
- imakesnowflakes 12y ago>The poster of that comment should RTFM... I am not sure I should go read the manual before setting a string key in an array to make sure that the specific string does not falls under some kind of special treatment. When normal people see that they can set string keys on something, they would assume that it work for all strings regardless of their content. And regarding PHP manual, it does not even have fundamental stuff right. This comment is from an ex php core developer. http://www.reddit.com/r/lolphp/comments/2md8c0/new_safe_casting_function_rfc_casting_10_to/cm3dpdj http://www.reddit.com/r/lolphp/comments/2md8c0/new_safe_cast... >using a == instead of a === would cause the desired result Except using == will result in a hundred other weird behaviors that have caused numerous many bugs and security vulnerabilities, that every one uses === with out exception..