3v4l.org

run code in 300+ PHP versions simultaneously
<?php ini_set('precision', 19); ini_set('serialize_precision', 19); $int = '0'; $z5 = $int . '.5'; $float = 2.5; $float = 0.49999999999999994; //$float = 0.156; //$float = 0.00000000000000001; //$float = 4503599627370495.5; //$float = 9007199254740991.0; //$float = 2.0; $copy = $float; $flstr = '+' . $copy . ''; $sign = trim($flstr, '.,0123456789'); $sign = strtr($sign, array('+' => '')); $int = (int) $float; $z5 = $int . '.5'; $tmp_value = $float; if($float > 0.0) { $nrnd1 = $float + 0.5; $nrnd2 = $float - 0.5; $rrnd = $nrnd2 + 0.5; if($rrnd == $float && $nrnd2 != $float) { $tmp_value = $nrnd1; } else { echo 'No'; } } else { $nrnd1 = 0.5 - $float; if(0.5 - $nrnd1 == $float) { $tmp_value = $float - 0.5; } } $zn = -0.1 * 0.0; var_dump($nrnd2, $tmp_value, -0.0 - 0.5, $float - 0.5); //ini_set('serialize_precision', 2); var_dump($float, 0.5 - $float, $float - 0.5, round($float));
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 34, Position 2 = 49
Branch analysis from position: 34
2 jumps found. (Code = 46) Position 1 = 42, Position 2 = 44
Branch analysis from position: 42
2 jumps found. (Code = 43) Position 1 = 45, Position 2 = 47
Branch analysis from position: 45
1 jumps found. (Code = 42) Position 1 = 48
Branch analysis from position: 48
1 jumps found. (Code = 42) Position 1 = 56
Branch analysis from position: 56
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 47
1 jumps found. (Code = 42) Position 1 = 56
Branch analysis from position: 56
Branch analysis from position: 44
Branch analysis from position: 49
2 jumps found. (Code = 43) Position 1 = 54, Position 2 = 56
Branch analysis from position: 54
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 56
filename:       /in/REjqX
function name:  (null)
number of ops:  76
compiled vars:  !0 = $int, !1 = $z5, !2 = $float, !3 = $copy, !4 = $flstr, !5 = $sign, !6 = $tmp_value, !7 = $nrnd1, !8 = $nrnd2, !9 = $rrnd, !10 = $zn
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'ini_set'
          1        SEND_VAL                                                 'precision'
          2        SEND_VAL                                                 19
          3        DO_ICALL                                                 
    4     4        INIT_FCALL                                               'ini_set'
          5        SEND_VAL                                                 'serialize_precision'
          6        SEND_VAL                                                 19
          7        DO_ICALL                                                 
    5     8        ASSIGN                                                   !0, '0'
    6     9        CONCAT                                           ~14     !0, '.5'
         10        ASSIGN                                                   !1, ~14
    8    11        ASSIGN                                                   !2, 2.5
    9    12        ASSIGN                                                   !2, 0.5
   15    13        ASSIGN                                                   !3, !2
   16    14        CONCAT                                           ~19     '%2B', !3
         15        CONCAT                                           ~20     ~19, ''
         16        ASSIGN                                                   !4, ~20
   17    17        INIT_FCALL                                               'trim'
         18        SEND_VAR                                                 !4
         19        SEND_VAL                                                 '.%2C0123456789'
         20        DO_ICALL                                         $22     
         21        ASSIGN                                                   !5, $22
   18    22        INIT_FCALL                                               'strtr'
         23        SEND_VAR                                                 !5
         24        SEND_VAL                                                 <array>
         25        DO_ICALL                                         $24     
         26        ASSIGN                                                   !5, $24
   19    27        CAST                                          4  ~26     !2
         28        ASSIGN                                                   !0, ~26
   20    29        CONCAT                                           ~28     !0, '.5'
         30        ASSIGN                                                   !1, ~28
   22    31        ASSIGN                                                   !6, !2
   23    32        IS_SMALLER                                               0, !2
         33      > JMPZ                                                     ~31, ->49
   24    34    >   ADD                                              ~32     !2, 0.5
         35        ASSIGN                                                   !7, ~32
   25    36        SUB                                              ~34     !2, 0.5
         37        ASSIGN                                                   !8, ~34
   26    38        ADD                                              ~36     !8, 0.5
         39        ASSIGN                                                   !9, ~36
   27    40        IS_EQUAL                                         ~38     !9, !2
         41      > JMPZ_EX                                          ~38     ~38, ->44
         42    >   IS_NOT_EQUAL                                     ~39     !8, !2
         43        BOOL                                             ~38     ~39
         44    > > JMPZ                                                     ~38, ->47
   28    45    >   ASSIGN                                                   !6, !7
   27    46      > JMP                                                      ->48
   30    47    >   ECHO                                                     'No'
   23    48    > > JMP                                                      ->56
   33    49    >   SUB                                              ~41     0.5, !2
         50        ASSIGN                                                   !7, ~41
   34    51        SUB                                              ~43     0.5, !7
         52        IS_EQUAL                                                 !2, ~43
         53      > JMPZ                                                     ~44, ->56
   35    54    >   SUB                                              ~45     !2, 0.5
         55        ASSIGN                                                   !6, ~45
   39    56    >   ASSIGN                                                   !10, -0
   41    57        INIT_FCALL                                               'var_dump'
         58        SEND_VAR                                                 !8
         59        SEND_VAR                                                 !6
         60        SEND_VAL                                                 -0.5
         61        SUB                                              ~48     !2, 0.5
         62        SEND_VAL                                                 ~48
         63        DO_ICALL                                                 
   43    64        INIT_FCALL                                               'var_dump'
         65        SEND_VAR                                                 !2
         66        SUB                                              ~50     0.5, !2
         67        SEND_VAL                                                 ~50
         68        SUB                                              ~51     !2, 0.5
         69        SEND_VAL                                                 ~51
         70        INIT_FCALL                                               'round'
         71        SEND_VAR                                                 !2
         72        DO_ICALL                                         $52     
         73        SEND_VAR                                                 $52
         74        DO_ICALL                                                 
         75      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.69 ms | 1019 KiB | 18 Q