Laravel developers tips

Helpful solutions for Laravel framework developers

float

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:

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

Copyright © 2023 Marcin Nabiałek