3v4l.org

run code in 300+ PHP versions simultaneously
<?php $number = 3.0000000000000002; $precision = 8; $delta = pow(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 = 18, Position 2 = 20
Branch analysis from position: 18
2 jumps found. (Code = 43) Position 1 = 23, Position 2 = 25
Branch analysis from position: 23
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 25
Branch analysis from position: 20
filename:       /in/ZVWNL
function name:  (null)
number of ops:  32
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        INIT_FCALL                                               'pow'
          3        SEND_VAL                                                 0.1
          4        SEND_VAR                                                 !1
          5        DO_ICALL                                         $8      
          6        ASSIGN                                                   !2, $8
   11     7        INIT_FCALL                                               'round'
          8        SEND_VAR                                                 !0
          9        SEND_VAR                                                 !1
         10        DO_ICALL                                         $10     
         11        ASSIGN                                                   !3, $10
   13    12        INIT_FCALL                                               'abs'
         13        SUB                                              ~12     !0, !3
         14        SEND_VAL                                                 ~12
         15        DO_ICALL                                         $13     
         16        IS_SMALLER                                               $13, !2
         17      > JMPZ                                                     ~14, ->20
   14    18    >   CAST                                          4  ~15     !0
         19        ASSIGN                                                   !4, ~15
   19    20    >   CAST                                          4  ~17     !0
         21        IS_EQUAL                                                 !0, ~17
         22      > JMPZ                                                     ~18, ->25
   20    23    >   CAST                                          4  ~19     !0
         24        ASSIGN                                                   !5, ~19
   25    25    >   CONCAT                                           ~21     'Rounded+result%3A+', !4
         26        CONCAT                                           ~22     ~21, '%0A'
         27        ECHO                                                     ~22
   26    28        CONCAT                                           ~23     'Inted+result%3A+', !5
         29        CONCAT                                           ~24     ~23, '%0A'
         30        ECHO                                                     ~24
         31      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
164.41 ms | 1396 KiB | 19 Q