Beginner PHP
Q38 / 100

What does declare(strict_types=1) do?

Correct! Well done.

Incorrect.

The correct answer is B) Forces strict type checking for scalar type declarations in that file

B

Correct Answer

Forces strict type checking for scalar type declarations in that file

Explanation

With strict_types=1 at the top of a file, passing a string to a function expecting int throws a TypeError instead of coercing.

Progress
38/100