Function Params for Multiple Type Hinting
// Multiple type hinting in one parameter
function myage(int|float|string $age){
echo $age;
}
myage("forty eight");
Here the $age parameter can be integer, float or string.
by dev
Function Params for Multiple Type Hinting
// Multiple type hinting in one parameter
function myage(int|float|string $age){
echo $age;
}
myage("forty eight");
Here the $age parameter can be integer, float or string.