Earlier quoted context omitted.
Isn't exactly their complaint? It's called an array, referred to consistently everywhere as an array, but it just ... isn't.
Better than calling it a hash.
PHP's Oddities
141–150 of 186 posts
Re: PHP's Oddities
#142PHP is bananas kinds of awesome. Yesterday, Cursor coughed up https://fdedictionary.com for me in PHP. You know what, it is like a dozen files and works awesome, no daemon needed, basically just a web server, some PHP files, and one SQLite file. Today, Claude Code, the major hotness, made changes to a (different) toy app with less complexity, in node.js and you know what, it has ~49,000 files. And uses a 3rd party Sa…
php -S 0.0.0.0:8000 public/index.php
It's not for production use, but only needing one Tool can be helpful under specific circumstances.Re: PHP's Oddities
#143> Despite all the critiquing I've done in this article, I still think the amount of hate PHP gets is undeserved. As a person who also codes in PHP at work, I still dislike the language syntax part. JS/TS also has terrible parts, but IMHO, compared to PHP, I don't face them as much and they are much easier to avoid when you have enough knowledge and stick to good parts. As the author mentioned, in my experience PHPs a…
Maybe you’ll find it helpful
Re: PHP's Oddities
#144How could you leave out left-associative ternary operators?
But apparently they deprecated and then changed(?!) the associativity in the past few years, which if anything just makes things even more confusing.
Re: PHP's Oddities
#145After over two decades of working in PHP, I'm now working in Java. PHP is basically Java-lite. I am absolutely loving the compile-time safety of Java, but I dearly miss PHP's maps and arrays. In Java, the amount of verbosity for defining a map/list and operating on it is overwhelming. Modern PHP is great. Many powerful language features, excellent performance, great community and package ecosystem, and decent enough…
> If you really do need the first element, you can use array_first That probably needs an array_second too, doesn't it? Maybe array_second_from_last as well?
Re: PHP's Oddities
#146PHP is bananas kinds of awesome. Yesterday, Cursor coughed up https://fdedictionary.com for me in PHP. You know what, it is like a dozen files and works awesome, no daemon needed, basically just a web server, some PHP files, and one SQLite file. Today, Claude Code, the major hotness, made changes to a (different) toy app with less complexity, in node.js and you know what, it has ~49,000 files. And uses a 3rd party Sa…
For Toy Apps you can even use PHP's integrated WebServer like php -S 0.0.0.0:8000 public/index.php It's not for production use, but only needing one Tool can be helpful under specific circumstances.
Re: PHP's Oddities
#147The hate PHP gets is from people with 15 year old ideas of what PHP is. It's just bandwagon effect at this point.
I agree, as I was one of them. Rightfully so, because PHP 20 years ago was the prime example of a complete disaster. Not just occasionally, there were long years of incompatibility, missing implementations, incoherent errors, security issues, fragmentation, etc. Paid my share of dealing with those problems with PHP 5 and 6 (after coming from PHP 4). I think it became a more sane ecosystem around very late 7.x to 8. I…
Hard to take this seriously when there was no PHP 6.
Re: PHP's Oddities
#148After over two decades of working in PHP, I'm now working in Java. PHP is basically Java-lite. I am absolutely loving the compile-time safety of Java, but I dearly miss PHP's maps and arrays. In Java, the amount of verbosity for defining a map/list and operating on it is overwhelming. Modern PHP is great. Many powerful language features, excellent performance, great community and package ecosystem, and decent enough…
If I remember it correctly, the "Java-lite" part comes rather late. PHP was more close to Perl and/or other old-days scripting language, it allows you to quickly launch a web page. Just and you get a hello page with a parameter specifiable via `?user=` query. But then people started to actually use it to build big sites, `echo($_GET['user'])` alone is not enough, it has to be: So people started to add module/componen…
Nice Java burn! But now days all you have to say to burn Java is "Lawnmower".
Re: PHP's Oddities
#149How could you leave out left-associative ternary operators?
That's exactly what I was expecting to read about upon seeing the article title. But apparently they deprecated and then changed(?!) the associativity in the past few years, which if anything just makes things even more confusing.
Once again showing how out of date peoples hate for PHP is
Re: PHP's Oddities
#150Earlier quoted context omitted.
I'm not familiar with PHP, can you elaborate on what you mean here? What is it compiling? Or are you referring to type safety?
When a php file is loaded at runtime, it runs through a very basic JIT compiler that does statically check a few things before continuing with execution. Syntax, for example, is checked for the entire file during this step. Most type checking happens at runtime (this might not be true for interfaces at some level, but I can’t say for 100% certain - I just know I tend to see interface related errors earlier during cod…
PHP parses the whole file and compiles it to Zend opcodes before executing it, so syntax errors are caught up front. But "JIT" means compiling an intermediate representation/opcodes into native machine code at runtime, when the functions are called, not at load time when the source file is parsed. If you just load a file and never call any of its code, the JIT compiler should never compile it.
PHP 8's OPcache JIT can do that optionally, but the normal load/parse/compile-to-opcodes step isn't JIT.