function multiply(int $a, int $b): int {
return $a * $b;
}
try {
echo multiply(7, "abc");
} catch (TypeError $e) {
echo "Error: " . $e->getMessage();
}
/*
run:
ERROR!
Error: multiply(): Argument #2 ($b) must be of type int, string given, called in main.php on line 8
*/