fork download
  1. <?php
  2. $value = 1500000;
  3. $percent_val = ((int)$value / 100) * 20;
  4. $maxvalue = (int)$value + $percent_val;
  5. $minvalue = (int)$value - $percent_val;
  6. echo "orgi:\n";
  7. echo round($minvalue)."-".round($maxvalue);
  8. echo "\nformatted:\n";
  9. echo sprintf("%ld-%ld", $minvalue, $maxvalue);
  10. echo "\n";
  11. ?>
Success #stdin #stdout 0.01s 20520KB
stdin
Standard input is empty
stdout
orgi:
1200000-1800000
formatted:
1200000-1800000