I previously mentioned my wish for an overhauled, more object-oriented PHP, a desire shared by many developers who work with PHP on a regular basis.
Well, the long journey toward such a thing might have just started. Someone has forked PHP, making quite a few syntax and performance improvements, and posted it on GitHub. Some of the improvements include:
- Faster strlen() performance
- A str_random() function to generate a random string of a specified length, optionally using a selection of valid characters to use.
- A timechop() function that splits a timestamp into an array containing the various units.
- A strcut() function that truncates a string to a specified length and optionally appends a specified character (e.g. “…”).
- Short array syntax. e.g.
$arr = [1, 2, [5 => "foo", 3.14159], 9]
.
I would like to see more of this, and for such enhancements to be pulled into the official PHP repository. (Also, I would like to see hosting providers keep current instead of trying to pass-off ancient versions of PHP…)