I have created a php test script test.php with the following code :
<?php
declare(strict_types=1);
function sum(int $a, int $b) : int {
return $a + $b ;
}
print(sum(2, 3));
Then when I try to run it, I am getting this fatal error:
Fatal error: strict_types declaration must be the very first statement in the script in C:\wamp\www\test.php on line 2
I am using PHP 7.2.4 on Wampserver 3.1.3 and I am accessing the script through my browser.