When i start reading it i did notice that you guys forgot about abvious think like type of to check if we have int, string, null or Boolean.
So i think gettype()
should be as 1st answer.
Explain:
So if we have $test = [1,w2,3.45,sasd];
we start test it
foreach ($test as $value) {
$check = gettype($value);
if($check == 'integer'){
echo "This var is int\r\n";
}
if($check != 'integer'){
echo "This var is {$check}\r\n";
}
}
And output:
> This var is int
> This var is string
> This var is double
> This var is string
I think this is easiest way to check if our var is int, string, double or Boolean.