I need to check if a value in an array is_float()
. But when I output the array with var_dump()
every decimal is recognized as string:
$sql = "SELECT * FROM table WHERE id = :mainID";
$result = $db->prepare($sql);
$result->bindParam(":mainID", $mainID, PDO::PARAM_INT);
$result->execute();
$mainData = $result->fetch();
var_dump($mainData);
Part of the var_dump Output:
["price"]=> string(6) "188.02"
Why isn't this value recognized as float, even though the column type in the DB is decimal?
Edit: Please note, that this question is about decimals. I don't care about INT
values.