3v4l.org

run code in 300+ PHP versions simultaneously
<?php $number = 3.0000000000000002; $precision = 8; $delta = 0.1 ** $precision; $rounded = round($number, $precision); if (abs($number -$rounded) < $delta) { $roundedResult = intval($number); } if ((int) $number == $number){ $intedResult = (int) $number; } echo "Rounded result: ".$roundedResult.PHP_EOL; echo "Inted result: ".$intedResult.PHP_EOL;
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 15, Position 2 = 17
Branch analysis from position: 15
2 jumps found. (Code = 43) Position 1 = 20, Position 2 = 22
Branch analysis from position: 20
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 22
Branch analysis from position: 17
filename:       /in/CeRde
function name:  (null)
number of ops:  29
compiled vars:  !0 = $number, !1 = $precision, !2 = $delta, !3 = $rounded, !4 = $roundedResult, !5 = $intedResult
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 3
    6     1        ASSIGN                                                   !1, 8
    8     2        POW                                              ~8      0.1, !1
          3        ASSIGN                                                   !2, ~8
   12     4        INIT_FCALL                                               'round'
          5        SEND_VAR                                                 !0
          6        SEND_VAR                                                 !1
          7        DO_ICALL                                         $10     
          8        ASSIGN                                                   !3, $10
   14     9        INIT_FCALL                                               'abs'
         10        SUB                                              ~12     !0, !3
         11        SEND_VAL                                                 ~12
         12        DO_ICALL                                         $13     
         13        IS_SMALLER                                               $13, !2
         14      > JMPZ                                                     ~14, ->17
   15    15    >   CAST                                          4  ~15     !0
         16        ASSIGN                                                   !4, ~15
   20    17    >   CAST                                          4  ~17     !0
         18        IS_EQUAL                                                 !0, ~17
         19      > JMPZ                                                     ~18, ->22
   21    20    >   CAST                                          4  ~19     !0
         21        ASSIGN                                                   !5, ~19
   26    22    >   CONCAT                                           ~21     'Rounded+result%3A+', !4
         23        CONCAT                                           ~22     ~21, '%0A'
         24        ECHO                                                     ~22
   27    25        CONCAT                                           ~23     'Inted+result%3A+', !5
         26        CONCAT                                           ~24     ~23, '%0A'
         27        ECHO                                                     ~24
         28      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
144.91 ms | 1396 KiB | 17 Q