- var_dump: documentation ( source)
<?php
declare(strict_types=1);
function setAge(int $age)
{
var_dump($age);
}
// First test is clearly wrong
// setAge("totally not an int"); <-- Fatal error expected int found string
// Try passing something like this
setAge("30+1");
// What about this?
setAge("30");
// Finally a real int :)
setAge(30);
// U jelly?
setAge(.1);