3 ms·
My understanding is that PHP was sort of started by people that did not plan for it like a "serious" programming language, but rather as a tool for specific app
by afiori 2y ago
My understanding is that PHP was sort of started by people that did not plan for it like a "serious" programming language, but rather as a tool for specific applications.
So it developed features and functionalities as needed with a very pragmatic focus [0][1]
[0] the most clear example to me is that since functions are not values and cannot be assigned to variables the way to store a function in a variable is to simply assign its name as a string so $callable = "array_map" works. Or that the way to create a pointer to a method is to create a 2 element array of the object and the method name.
I like this example because the way method pointers work in JavaScript is objectively worse as the "this" is easily lost.
Some languages are built on CS principles and PL theory, others like Bash or PHP are just built to get shit done. I am glad that recent versions are fixing some of the oversight of this approach while keeping the pragmatic culture
[1] I am not sure of how true it is, but some claim that some of the standard functions have irregular names because the interpreter used the name length as hash key
- scq 2y ago[1] is true. Here it is straight from PHP's creator: https://news-web.php.net/php.internals/70691 https://news-web.php.net/php.internals/70691