Reputation: 6304
I am using codeigniter, and when selecting from the MySQL DB, an integer, I get a string, like "1", and I want it to return 1.
Here is a solution to this problem, using PDO: How to get numeric types from MySQL using PDO?
I don't know how to apply it to my situation, using Codeigniter 3, and PHP 7 (it uses the mysqli driver)
PHP type casting is too slow for me, Here is a post about it (so please don't suggest doing this): PHP - Recursive in place replacing of strings to numbers takes too long
Upvotes: 1
Views: 99
Reputation: 7447
It depends on the mysql client driver.
This driver has been the default since PHP 5.4, so you should already be using it.
You can use phpinfo() to find out which driver you are using for sure. Look for the MySQL section and it will say something like:
Client API version mysqlnd 5.0.11-dev
Upvotes: 1