Laravel developers tips

Helpful solutions for Laravel framework developers

precision

Tricky things in PHP – floats

July 27, 2016 by Marcin Nabiałek / 2 Comments

As Laravel developer we don’t deal only with Laravel specific features, but quite often with pure PHP. Let’s verify your knowledge a bit. What would be the result of the following script:

PHP
1
2
3
<?php
 
die(var_dump(1200.85 * 100 === 120085));

Possible answers: false true It depends … Okay, you’ve chosen your answer. The second question – would the answer change if we … [Read more…]

Posted in: PHP Tagged: comparison, float, precision

Marcin Nabiałek

Marcin Nabiałek - Certified Laravel Developer
Marcin Nabiałek - Zend Certified PHP Engineer

Categories

  • Composer
  • Eloquent
  • Laravel
  • Laravel Blade
  • Laravel Dusk
  • Laravel packages
  • Mockery
  • PHP
  • PhpUnit
  • Request
  • Testing
  • Validation

Recent Posts

  • More flexible Laravel 7 Blade X components
  • Unit tests – complex argument matching with Mockery::on – the right way
  • Laravel validation – use multiple Form requests for complex scenarios
  • How to backup Laravel application to FTP/local computer
  • Best ways to validate data in Laravel

Recent Comments

  • Marcin Nabiałek on Laravel validation – use multiple Form requests for complex scenarios
  • Arek on Laravel validation – use multiple Form requests for complex scenarios
  • Marcin Nabiałek on I’m Laravel Certified Developer
  • Ridvan on I’m Laravel Certified Developer
  • cristi mocean on How to make your Laravel (Dusk) tests 3 times Faster

Archives

  • April 2020
  • December 2018
  • November 2018
  • October 2018
  • July 2018
  • October 2017
  • September 2017
  • April 2017
  • January 2017
  • December 2016
  • August 2016
  • July 2016
  • June 2016

Categories

  • Composer
  • Eloquent
  • Laravel
  • Laravel Blade
  • Laravel Dusk
  • Laravel packages
  • Mockery
  • PHP
  • PhpUnit
  • Request
  • Testing
  • Validation

Meta

  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org

Copyright © 2026 Marcin Nabiałek