fork download
  1. <?php
  2.  
  3. $number = "123.00";
  4. echo ($number == (int) $number) ? (int) $number : $number, PHP_EOL;
  5. // 123
  6.  
  7. $number = "123.10";
  8. echo ($number == (int) $number) ? (int) $number : $number, PHP_EOL;
  9. // 123.10
  10.  
  11. $number = "123.1000";
  12. echo ($number == (int) $number) ? (int) $number : $number, PHP_EOL;
  13. // 123.1000
Success #stdin #stdout 0.01s 82880KB
stdin
Standard input is empty
stdout
123
123.10
123.1000