3v4l.org

run code in 300+ PHP versions simultaneously
<?php $list = [ 4 => 'first', // 1 - 4 7 => 'next', // 5 = 7 10 => 'third group', // 8 - 10 12 => 'another group', // 11, 12 95 => 'huge chunk', // 13 - 95 97 => 'almost done', // 96, 97 100 => 'last' // 98 - 100 ]; $num = rand(1, 100); foreach ($list as $key => $group) { echo "$num vs $key\n"; if ($num <= $key) { break; // don't iterate anymore after finding group } } echo "Num = $num, Group = $group";
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 7, Position 2 = 18
Branch analysis from position: 7
2 jumps found. (Code = 78) Position 1 = 8, Position 2 = 18
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 16, Position 2 = 17
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 18
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
Branch analysis from position: 18
Branch analysis from position: 18
filename:       /in/OnDqB
function name:  (null)
number of ops:  25
compiled vars:  !0 = $list, !1 = $num, !2 = $group, !3 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   13     1        INIT_FCALL                                               'rand'
          2        SEND_VAL                                                 1
          3        SEND_VAL                                                 100
          4        DO_ICALL                                         $5      
          5        ASSIGN                                                   !1, $5
   14     6      > FE_RESET_R                                       $7      !0, ->18
          7    > > FE_FETCH_R                                       ~8      $7, !2, ->18
          8    >   ASSIGN                                                   !3, ~8
   15     9        ROPE_INIT                                     4  ~11     !1
         10        ROPE_ADD                                      1  ~11     ~11, '+vs+'
         11        ROPE_ADD                                      2  ~11     ~11, !3
         12        ROPE_END                                      3  ~10     ~11, '%0A'
         13        ECHO                                                     ~10
   16    14        IS_SMALLER_OR_EQUAL                                      !1, !3
         15      > JMPZ                                                     ~13, ->17
   17    16    > > JMP                                                      ->18
   14    17    > > JMP                                                      ->7
         18    >   FE_FREE                                                  $7
   20    19        ROPE_INIT                                     4  ~15     'Num+%3D+'
         20        ROPE_ADD                                      1  ~15     ~15, !1
         21        ROPE_ADD                                      2  ~15     ~15, '%2C+Group+%3D+'
         22        ROPE_END                                      3  ~14     ~15, !2
         23        ECHO                                                     ~14
         24      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.72 ms | 1010 KiB | 14 Q