As asked above, are we still required to put declare(strict_types=1)
in the header of every single program in our projects in PHP 8.1?
I'd love for it to be just strict all the time.
Yes! Tested with PHP 8.1.7 there is still a difference.
See this question to understand what the strict types do.
New in PHP 8.1: when a float value is coerced to an int value implicitly, like in the example from the other question, a deprecation notice is triggered:
PHP Deprecated: Implicit conversion from float 1.4 to int loses precision
. More details
Further reading
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With