"For instance, 123 == “123foo” evaluates to true (see what it’s doing there?), but 0123 == “0123foo” is false (hmm)." Can anyone explain this to me? I know if a string starts with the number, PHP takes the number part and throws the rest, so "0123foo" should be 0123 for the comparison, so why is that false?
Edit: I was wrong. 0123 is octal, not decimal [Incorrect original post: 0123 evaluates to the integer value 123]
Taking PHP Seriously (2016)
31–40 of 150 posts
Re: Taking PHP Seriously (2016)
#32"For instance, 123 == “123foo” evaluates to true (see what it’s doing there?), but 0123 == “0123foo” is false (hmm)." Can anyone explain this to me? I know if a string starts with the number, PHP takes the number part and throws the rest, so "0123foo" should be 0123 for the comparison, so why is that false?
Edit: I was wrong. 0123 is octal, not decimal [Incorrect original post: 0123 evaluates to the integer value 123]
Re: Taking PHP Seriously (2016)
#33So the entire argument is that PHP is single threaded and each request starts with no state? Am I missing anything else? I’m trying so hard not to rant here, so I just wanted to confirm that those are the only positives he outlines about the language.
Not that hard, there's a bias showing.
First, those things you've mentioned are nothing to sneer at, are actual very good decisions (even if accidental) for a webserver-centric language.
They enable even naive developers to achive good scalability and isolation, and make fast development/debug cycles trivial.
Second, PHP has been improved by leaps and bounds from the days of 4, to the point of being a totally different language - all of the above points are already made in TFA.
Most arguments against it are moot today, or only apply superficially to the standard library, not the language (order of arguments, and so on).
Plus, it is speedy too, post 6, and especially post 7 (and there's a whole new JIT in 8). In any case, it has constant work on speed and memory reduction.
And of course it has a huge ecosystem of libs, projects, and frameworks, including not available anywhere else projects like Wordpress.
And the standard library (warts included) between JSON, DB drivers, LDAP support, SMTP, etc., is one of the most complete ones this side of Python, and perhaps even fitter than Python's for typical web development work.
Plus the deployment model is one of the best. Copy your files to a directory. Done. Add a redirect instruction to your server if you want to make it more fancy...
For third party libs, composer is up there with any major package dependency/install solution.
And for the core libs, plugins, etc installation is handled perfectly by the standard package managers in all Linux distros (and probably Windows too), and is even easier with MAMP, WAMP, etc for local development. Trivial to dockerize too if that's your thing.
Re: Taking PHP Seriously (2016)
#34This seems to be an unpopular opinion in the tech world, but I honestly enjoy working with PHP. It's such a simple, robust language, and you can use it in many different ways, depending on what you're building (OOP, scripting, microservices, etc).
Re: Taking PHP Seriously (2016)
#35Re: Taking PHP Seriously (2016)
#36"For instance, 123 == “123foo” evaluates to true (see what it’s doing there?), but 0123 == “0123foo” is false (hmm)." Can anyone explain this to me? I know if a string starts with the number, PHP takes the number part and throws the rest, so "0123foo" should be 0123 for the comparison, so why is that false?
Edit: I was wrong. 0123 is octal, not decimal [Incorrect original post: 0123 evaluates to the integer value 123]
Re: Taking PHP Seriously (2016)
#37So the entire argument is that PHP is single threaded and each request starts with no state? Am I missing anything else? I’m trying so hard not to rant here, so I just wanted to confirm that those are the only positives he outlines about the language.
You might have missed this bit - "Did Facebook, Wikipedia, WordPress, Etsy, Baidu, Box, and more recently Slack all succeed in spite of using PHP?"
Plenty of languages have support for hot reloading, which means you can just edit, save, refresh exactly the same as in PHP, with the added benefit of not having to use PHP.
Re: Taking PHP Seriously (2016)
#38"For instance, 123 == “123foo” evaluates to true (see what it’s doing there?), but 0123 == “0123foo” is false (hmm)." Can anyone explain this to me? I know if a string starts with the number, PHP takes the number part and throws the rest, so "0123foo" should be 0123 for the comparison, so why is that false?
Edit: I was wrong. 0123 is octal, not decimal [Incorrect original post: 0123 evaluates to the integer value 123]
Re: Taking PHP Seriously (2016)
#39Given PHP 8 has been released, does Hack provide enough value to consider it as an alternative? My take on it is no, but I'm curious about other people's opinions.
It is good to keep in mind that this article is more than four years old. I would advise against Hack at this point since most of the good bits have been integrated into the main PHP release - typing is a lot more predictable and enforceable for instance.
Re: Taking PHP Seriously (2016)
#40The best language for a startup is one the founders know the best. Every other discussion will at best make a 1% difference.