3v4l.org

run code in 300+ PHP versions simultaneously
<?php $input = "turn on 0,0 through 999,999"; $lights = [[]]; for($i = 0; $i<1000; $i++){ for($j = 0; $j<1000; $j++){ $lights[$i][$j] = 0; } } explode("\n",$input); function action($s){ $on = preg_match("/turn on/"); $off = preg_match("/turn off/"); $toggle = preg_match("/toggle/"); if($on > 0){ return 1; } else if($off>0){ return 2; } else if($toggle>0){ return 3; } } echo action($input); ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
2 jumps found. (Code = 44) Position 1 = 15, Position 2 = 4
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
2 jumps found. (Code = 44) Position 1 = 12, Position 2 = 6
Branch analysis from position: 12
2 jumps found. (Code = 44) Position 1 = 15, Position 2 = 4
Branch analysis from position: 15
Branch analysis from position: 4
Branch analysis from position: 6
2 jumps found. (Code = 44) Position 1 = 12, Position 2 = 6
Branch analysis from position: 12
Branch analysis from position: 6
filename:       /in/SDOZB
function name:  (null)
number of ops:  24
compiled vars:  !0 = $input, !1 = $lights, !2 = $i, !3 = $j
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, 'turn+on+0%2C0+through+999%2C999'
    4     1        ASSIGN                                                   !1, <array>
    6     2        ASSIGN                                                   !2, 0
          3      > JMP                                                      ->13
    7     4    >   ASSIGN                                                   !3, 0
          5      > JMP                                                      ->10
    8     6    >   FETCH_DIM_W                                      $8      !1, !2
          7        ASSIGN_DIM                                               $8, !3
          8        OP_DATA                                                  0
    7     9        PRE_INC                                                  !3
         10    >   IS_SMALLER                                               !3, 1000
         11      > JMPNZ                                                    ~11, ->6
    6    12    >   PRE_INC                                                  !2
         13    >   IS_SMALLER                                               !2, 1000
         14      > JMPNZ                                                    ~13, ->4
   12    15    >   INIT_FCALL                                               'explode'
         16        SEND_VAL                                                 '%0A'
         17        SEND_VAR                                                 !0
         18        DO_ICALL                                                 
   29    19        INIT_FCALL                                               'action'
         20        SEND_VAR                                                 !0
         21        DO_FCALL                                      0  $15     
         22        ECHO                                                     $15
   31    23      > RETURN                                                   1

Function action:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 15, Position 2 = 17
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
2 jumps found. (Code = 43) Position 1 = 19, Position 2 = 21
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 21
2 jumps found. (Code = 43) Position 1 = 23, Position 2 = 24
Branch analysis from position: 23
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 24
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/SDOZB
function name:  action
number of ops:  25
compiled vars:  !0 = $s, !1 = $on, !2 = $off, !3 = $toggle
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   RECV                                             !0      
   15     1        INIT_FCALL                                               'preg_match'
          2        SEND_VAL                                                 '%2Fturn+on%2F'
          3        DO_ICALL                                         $4      
          4        ASSIGN                                                   !1, $4
   16     5        INIT_FCALL                                               'preg_match'
          6        SEND_VAL                                                 '%2Fturn+off%2F'
          7        DO_ICALL                                         $6      
          8        ASSIGN                                                   !2, $6
   17     9        INIT_FCALL                                               'preg_match'
         10        SEND_VAL                                                 '%2Ftoggle%2F'
         11        DO_ICALL                                         $8      
         12        ASSIGN                                                   !3, $8
   18    13        IS_SMALLER                                               0, !1
         14      > JMPZ                                                     ~10, ->17
   19    15    > > RETURN                                                   1
         16*       JMP                                                      ->24
   21    17    >   IS_SMALLER                                               0, !2
         18      > JMPZ                                                     ~11, ->21
   22    19    > > RETURN                                                   2
         20*       JMP                                                      ->24
   24    21    >   IS_SMALLER                                               0, !3
         22      > JMPZ                                                     ~12, ->24
   25    23    > > RETURN                                                   3
   27    24    > > RETURN                                                   null

End of function action

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
165.83 ms | 1403 KiB | 18 Q