Type Hinting Cannot be used to require a parameter to be of a particular scalar type (such as integer or string or to have a particular trait.
_Programming Php_
code:
<?php
function yeld(int $a){
print $a;
}
random(5);
random("hey");
?>
output:
5
Fatal error: Uncaught TypeError: Argument 1 passed to random() must be of the type integer, string given, called
_Programming Php_
code:
<?php
function yeld(int $a){
print $a;
}
random(5);
random("hey");
?>
output:
5
Fatal error: Uncaught TypeError: Argument 1 passed to random() must be of the type integer, string given, called