Hacker News new | ask | show | jobs
by abdusco 1670 days ago
I really want to use PHP for one-off CGI scripts, (rsync files and done, deployed), but I really wish it had methods on primitive types. It hinders discoverability. It's annoying having to look up which function I need to use, and to find that there are many alternatives, most of which are deprecated.

PHP stdlib needs an overhaul, IMO.

2 comments

I agree, it'd be nice if the built in was more standardized and had more features.

However you do have options to choose from with php these days. Really well maintained libraries exist for basically everything you could want, often they are fast, well tested and modular. And it's nice because you can even choose the style you prefer with this.

Grab the symphony string lib for instance: https://symfony.com/doc/current/components/string.html

Wouldn't that be pretty bad for backwards compatibility?
You can always keep the old.

However I don't think it is something that will ever be done, designing a good standard library is quite difficult, especially by email and rfc.

I think it is better if the community designs one that gets a lot of traction to become de facto standard. All the large frameworks already has their own standard library.

With the performance improvements to PHP over the years it is no longer a detriment to performance to write a standard library in PHP.

And if we can get the operator overloads rfc passed we can have userland scalar objects

https://wiki.php.net/rfc/user_defined_operator_overloads