PHP 8.2.0 RC1 available for testing
php.net
php.net
Amazing to see so much evolution for PHP- autoloading and automatic file-based routing are such killer features for rapid development.
Fibers are going to be a gamechanger for performance once libraries start adopting it.
I'm curious to see how useful it is until a lot of core libraries (curl, redis, mysqlnd, etc) can be called non-blocking and/or trigger a fiber yield during a block? My understanding is swoole does a whole lot of work to enable hooking into those to allow coroutines, which won't implicitly exist with fibers?
This is why fibers are so big. It'll bring performance without the downsides.
Performance without downsides.
Plenty of technical reasons but for me, the biggest is unity among libraries/technologies. There been versions of coroutines/fibers around PHP for many years, first time I heard about it was a PHP fork that implemented fibers, don't recall the name but must have been something like 10 years ago...
But the problem has always been that you cannot rely on the community having things like that available.
Having it in the core language, means that more libraries can depend on it, and users are therefore incentives to learn more about it, as they can rely on it sticking around.
Overall, I'm happy it's coming into the core language.
Probably thinking of HHVM/Hack: https://docs.hhvm.com/hack/asynchronous-operations/introduct...
Symfony 6.1 and the upcoming Laravel 10 require PHP 8.1+, but I don't see them using fibers yet. We'll have to wait and see.
{ and } is optional
$ is optional
new is optional
attribute access -> is now .
associative array (dict / map) => is now :
There is a but though, don't make PHP your last language, broaden your horizon.
I mean all this push for "Rust in the kernel" is nice and all, but do we really need fancy things like "transitive equality"? They have played us for absolute fools.
Sometimes you just want a language that really puts in the work to find a reason why "0x10" == "16z" should be true, no matter what kind of improbable implicit casts have to be done to get there.
PHP makes the impossible possible, and you've got to keep life interesting or it would be too predictable!
$ php -r 'var_dump("0x10" == "16z");'
bool(false)
$ php -r 'var_dump(0x10 == "16z");'
bool(false)
$ php -r 'var_dump(0x10 == (int)"16z");'
bool(true)Then I discovered Go which is like a grown-up version of PHP. Really simple to get started, solid standard library (PHP relies a lot on extensions), and fixes all the little things like formatting/styling, testing, error handling, benchmarking, modules, and parallel code execution.
It does all this in much less memory and is much faster.
Go is an excellent replacement for PHP when you start hitting the limits of little Laravel apps.
I mean, Go is still miles above scripting land. 75% of all the cloud computing projects are in Go and if you deal with micro services you'll find a lot of the tooling and systems are written in Go.
If you're using PHP, then Go or Java is much easier upgrade path than Rust.
I absolutely agree they have their place... but I don't have regrets. I'll get into JS Frameworks, Node, and all of that later as it never, ever hurts to broaden experience, but I have no regrets with jumping into PHP first because the productivity level is fantastic when tied to a framework to avoid the footguns. PHP has footguns, some infamous, but so does any framework or language.
Escaping is typically handled in the framework.
You need to use a similar PHP framework, with one such framework you don't need to escape html or sql stuff.
[0]: https://github.com/jbboehr/php-handlebars [1]: https://github.com/jbboehr/php-mustache [2]: https://www.smarty.net/ [3]: https://twig.symfony.com/