PHP Subtracting two number gives wrong values [closed]

When I execute your code I’ll get an syntax error, because of the comma. So I’ve changed it a bit. This will result in the float that you see on your screen

<?php
$a = 25.787;
$b = 5.661;
$c = $b - $a;

echo $c;
?>

Please note that this will generate a float. But it looks like that you want to works with thousands. That will work when you remove the comma/dot

<?php
//Enter your code here, enjoy!
$a = 25787;
$b = 5661;
$c = $b - $a;

echo $c;
?>

Browse More Popular Posts

Leave a Comment