Category: PHP, PHP

Since https://secure.php.net/manual/en/migration70.new-features.php, PHP has the ability to use strict type checking. Let us look at the differences between loose and strict type checking. Afterward, we can have a look at enforcing strict type checking in every file of our project. To illustrate the difference be loose type checking and strict type checking, consider the following method: function add(int $a, int $b): int { return $a + $b; } With loose type checking, all these calls would yield a result: add(3, 3); add(3, '3'); add(3, 3.0); add(3, true); Internally, PHP casts each parameter into an integer.
Newsletter

Get the latest Laravel/PHP jobs, events and curated articles straight to your inbox, once a week

Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future. Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future.
Community Partners