There's no difference between the PHP versions that would cause this. There are differences between different mysql drivers, however, and that could cause the issue that you are seeing.
Homestead comes with php5-mysqlnd
installed, which is the "MySql Native Driver". When using this driver, floating points and integers fetched from the database will be assigned as numeric datatypes in PHP. If you are not using the native driver (php5-mysql
), floating points and integers fetched from the database will be assigned as strings in PHP.
The following code demonstrates how this affects your output:
$f = 9.99000;
$s = "9.99000";
echo $f; // shows 9.99
echo $s; // shows 9.99000
You can check to see if the server is using the native driver with the command php -i | grep mysqlnd
. This is just searching through your phpinfo()
for any mention of the native driver. If this doesn't return anything, then you are not using the native driver, and your numeric data will be returned as strings.
If you do not have the native driver installed, you will need to remove the old driver and install the new driver:
apt-get remove php5-mysql
apt-get install php5-mysqlnd
Assuming this was your issue in the first place, this will fix it. You can also check out this question and answer for more information.