3v4l.org

run code in 300+ PHP versions simultaneously
<?php function print_array(array $arr) { foreach ($arr as $k => $a){ if ($k && $k % 3 == 0) { echo "something awesome\n"; } echo "$a \n"; } } echo("================ Multiple of 3 =================\n"); print_array(range(11, 19)); echo("\n"); echo("============== Not multiple of 3 ===============\n"); print_array(range(11, 20)); echo("\n"); //
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Y9hTo
function name:  (null)
number of ops:  19
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   ECHO                                                     '%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D+Multiple+of+3+%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%0A'
   13     1        INIT_FCALL                                               'print_array'
          2        INIT_FCALL                                               'range'
          3        SEND_VAL                                                 11
          4        SEND_VAL                                                 19
          5        DO_ICALL                                         $0      
          6        SEND_VAR                                                 $0
          7        DO_FCALL                                      0          
   14     8        ECHO                                                     '%0A'
   16     9        ECHO                                                     '%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D+Not+multiple+of+3+%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%0A'
   17    10        INIT_FCALL                                               'print_array'
         11        INIT_FCALL                                               'range'
         12        SEND_VAL                                                 11
         13        SEND_VAL                                                 20
         14        DO_ICALL                                         $2      
         15        SEND_VAR                                                 $2
         16        DO_FCALL                                      0          
   18    17        ECHO                                                     '%0A'
   20    18      > RETURN                                                   1

Function print_array:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 14
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 14
Branch analysis from position: 3
2 jumps found. (Code = 46) Position 1 = 5, Position 2 = 8
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 10
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 10
Branch analysis from position: 8
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
filename:       /in/Y9hTo
function name:  print_array
number of ops:  16
compiled vars:  !0 = $arr, !1 = $a, !2 = $k
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1      > FE_RESET_R                                       $3      !0, ->14
          2    > > FE_FETCH_R                                       ~4      $3, !1, ->14
          3    >   ASSIGN                                                   !2, ~4
    5     4      > JMPZ_EX                                          ~6      !2, ->8
          5    >   MOD                                              ~7      !2, 3
          6        IS_EQUAL                                         ~8      ~7, 0
          7        BOOL                                             ~6      ~8
          8    > > JMPZ                                                     ~6, ->10
    6     9    >   ECHO                                                     'something+awesome%0A'
    8    10    >   NOP                                                      
         11        FAST_CONCAT                                      ~9      !1, '+%0A'
         12        ECHO                                                     ~9
    4    13      > JMP                                                      ->2
         14    >   FE_FREE                                                  $3
   10    15      > RETURN                                                   null

End of function print_array

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.7 ms | 1017 KiB | 16 Q