Support the ongoing development of Laravel.io →
posted 10 years ago
Database

I asked this question on StackOverflow but I'm not getting any response there, so I'm posting it here hoping that someone can shed some light on this.

I noticed that a DB insert with floating numbers using HHVM is cutting off the decimal part. In the example below, the value actually stored in the MySQL database is 7.00. The MySQL field is a decimal field.

DB::table('test')->insert([
    [
        'name'        => 'Some name',
        'description' => 'Some description',
        'price'       => 7.99
    ]);

When using PHP instead of HHVM, the value is stored correctly. Also, when replacing 7.99 with '7.99' (as a string) using HHVM, the value is also stored correctly.

Is this an incompatibility between Laravel's insert() function and HHVM, or am I overlooking something here?

Last updated 3 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

lowerends lowerends Joined 27 Feb 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.