It is somewhat common knowledge that with different versions of php and mysql, and by using native prepared statements or emulated prepared statements it is possible to have natine value types or not, like this:
$value = $db->query("SELECT 1033 AS Code")->fetch(PDO::FETCH_COLUMN)
$value2 = $db->query("SELECT '1033' AS Code")->fetch(PDO::FETCH_COLUMN);
//PDO::ATTR_EMULATE_PREPARES set to true:
var_dump($value); // string(4) "1033"
var_dump($value2); // string(4) "1033"
//PDO::ATTR_EMULATE_PREPARES set to false:
var_dump($value); // int(1033)
var_dump($value2); // string(4) "1033"
from this article:
The problem is that PDO causes a zval-separation due to a type cast to string. The cast is requested by the PDO core.
PDO will always cast data to string by default and the PDO_MYSQL driver can only work around this PDO default by returning zvals.
Why does PDO will always cast data to string?