by smt88 · 9y ago · 0 comments
It has to do with the lack of static types, the "flexible" (i.e. lax) syntax, silent errors, and type coercion. But, even more than that, it has to do with the practices of PHP's maintainers. I suspect HHVM is better, but I can't say for sure.
Just one man's opinion, of course.
We're using PHP 7, with declare(strict_types=1) everywhere.
> the "flexible" (i.e. lax) syntax, silent errors, and type coercion
We use return types with strict_types=1, and throw exceptions if something is going wrong rather than proceeding with invalid state. If something was going to return a falsy value where e.g. a string was expected, PHP will throw a TypeError instead. https://3v4l.org/8VR05
> But, even more than that, it has to do with the practices of PHP's maintainers. I suspect HHVM is better, but I can't say for sure.
The release manager for PHP 7.2 is a former HHVM dev, who is very much about correctness and maintainability.
It sounds like your opinion of PHP is based on circa 5.3 and earlier, but a lot has improved in 7.0 and newer. I'd definitely recommend giving newer code a second look.
http://www.hongkiat.com/blog/php7/
https://paragonie.com/blog/2017/02/cryptographically-secure-...