Musings of a Programmer

Rarely-used blog of Dan Harper.
View all blog posts

By default, when PHP receives data from MySQL, all data is cast as a string - even integers!

You want the MySQL Native Driver for PHP (mysqlnd).

Now PHP recognises MySQL data types and will cast them appropriately :)

Install on Ubuntu: sudo apt-get install php5-mysqlnd. Install on OS X with Brew: brew install php5-mysqlnd.