I am trying to parse a POST (x-www-form-urlencoded) request which includes an array like this:
Now, when I loop through that:
$arr = $_POST["fieldvalue"];
foreach($arr as $key => $value)
{
if(empty($value) || is_null($value))
{
echo "Something in the array is null";
}
}
The echo-line is never done, because $value
is actually "null"
and not null
.
That array may contain any type of value, like strings, integers, booleans, floats, ... so I don't think I can just do if($value === "null")
, which does work in this example.
What I am trying to get at is that how do I parse that POST-data like so that all the "null"
values get converted to proper null
values, so that I can properly check for nulls?