3v4l.org

run code in 300+ PHP versions simultaneously
<?php $diffs = []; $unexpectedTraditional = $unexpectedNew = 0; foreach (range(1, 99999) as $i) { $float = $i / 100; $multiple1 = $float * 100; $multiple2 = (float) (string) ($float * 100); $int1 = (int) $multiple1; $int2 = (int) $multiple2; if ($int1 !== $int2) { $diffs[] = $i; if ($int1 !== $i) { $unexpectedTraditional++; } if ($int2 !== $i) { $unexpectedNew++; } } } echo 'Unexpected count traditional approach: '.$unexpectedTraditional."\n"; echo 'Unexpected count new approach: '.$unexpectedNew."\n"; //echo 'Differences for:'."\n"; //var_dump($diffs);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 8, Position 2 = 32
Branch analysis from position: 8
2 jumps found. (Code = 78) Position 1 = 9, Position 2 = 32
Branch analysis from position: 9
2 jumps found. (Code = 43) Position 1 = 23, Position 2 = 31
Branch analysis from position: 23
2 jumps found. (Code = 43) Position 1 = 27, Position 2 = 28
Branch analysis from position: 27
2 jumps found. (Code = 43) Position 1 = 30, Position 2 = 31
Branch analysis from position: 30
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 31
Branch analysis from position: 28
Branch analysis from position: 31
Branch analysis from position: 32
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 32
filename:       /in/JdfjZ
function name:  (null)
number of ops:  40
compiled vars:  !0 = $diffs, !1 = $unexpectedTraditional, !2 = $unexpectedNew, !3 = $i, !4 = $float, !5 = $multiple1, !6 = $multiple2, !7 = $int1, !8 = $int2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    4     1        ASSIGN                                           ~10     !2, 0
          2        ASSIGN                                                   !1, ~10
    6     3        INIT_FCALL                                               'range'
          4        SEND_VAL                                                 1
          5        SEND_VAL                                                 99999
          6        DO_ICALL                                         $12     
          7      > FE_RESET_R                                       $13     $12, ->32
          8    > > FE_FETCH_R                                               $13, !3, ->32
    7     9    >   DIV                                              ~14     !3, 100
         10        ASSIGN                                                   !4, ~14
    9    11        MUL                                              ~16     !4, 100
         12        ASSIGN                                                   !5, ~16
   10    13        MUL                                              ~18     !4, 100
         14        CAST                                          6  ~19     ~18
         15        CAST                                          5  ~20     ~19
         16        ASSIGN                                                   !6, ~20
   12    17        CAST                                          4  ~22     !5
         18        ASSIGN                                                   !7, ~22
   13    19        CAST                                          4  ~24     !6
         20        ASSIGN                                                   !8, ~24
   15    21        IS_NOT_IDENTICAL                                         !7, !8
         22      > JMPZ                                                     ~26, ->31
   16    23    >   ASSIGN_DIM                                               !0
         24        OP_DATA                                                  !3
   18    25        IS_NOT_IDENTICAL                                         !7, !3
         26      > JMPZ                                                     ~28, ->28
   19    27    >   PRE_INC                                                  !1
   21    28    >   IS_NOT_IDENTICAL                                         !8, !3
         29      > JMPZ                                                     ~30, ->31
   22    30    >   PRE_INC                                                  !2
    6    31    > > JMP                                                      ->8
         32    >   FE_FREE                                                  $13
   27    33        CONCAT                                           ~32     'Unexpected+count+traditional+approach%3A+', !1
         34        CONCAT                                           ~33     ~32, '%0A'
         35        ECHO                                                     ~33
   28    36        CONCAT                                           ~34     'Unexpected+count+new+approach%3A+', !2
         37        CONCAT                                           ~35     ~34, '%0A'
         38        ECHO                                                     ~35
   30    39      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.69 ms | 1400 KiB | 15 Q