3v4l.org

run code in 300+ PHP versions simultaneously
<?php $map = ' \\ / / / / / \\ \\ \\ / \\ /\\ \\/ \\ / \\ \\ \\ \\ \\ \\ / /'; var_dump( r($map)); function r($m){ $z=strpos($m,"/\\"); $z-=strrpos(substr($m,0,$z),"\n"); $ls=explode("\n",$m);$i=0; $a=[1=>0,2=>0,3=>0,4=>0]; foreach($ls as $l){ $y=$i<count($ls)/2?0:1;echo $y+1+($y?2:1); // $s = substr($l,0,$z-1); // $a[$y+0+$y?2:1]++;//[] = strpos($s,"/")?"/":(strpos($s,"\\")?"\\":""); // $s = substr($l,$z); // $a[$y+1+$y?2:1]++;//[] = strpos($s,"/")?"/":(strpos($s,"\\")?"\\":"");; $i++; } return $a; }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/0DHOZ
function name:  (null)
number of ops:  8
compiled vars:  !0 = $map
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, '++++++++++++++++++%5C%0A++++++%2F++++++++++%2F%0A+++++++%2F++++++++%2F%0A++++++++%2F++++++%5C%0A+++++++++%5C++++%5C%0A++++++++++%2F++%5C%0A+++++++++++%2F%5C%0A+++++++++++%5C%2F%0A++++++++++%5C++%2F%0A+++++++++%5C++++%5C%0A++++++++%5C++++++%5C%0A+++++++%5C++++++++%5C%0A++++++%2F++++++++++%2F'
   15     1        INIT_FCALL                                               'var_dump'
          2        INIT_FCALL_BY_NAME                                       'r'
          3        SEND_VAR_EX                                              !0
          4        DO_FCALL                                      0  $2      
          5        SEND_VAR                                                 $2
          6        DO_ICALL                                                 
   31     7      > RETURN                                                   1

Function r:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 24, Position 2 = 42
Branch analysis from position: 24
2 jumps found. (Code = 78) Position 1 = 25, Position 2 = 42
Branch analysis from position: 25
2 jumps found. (Code = 43) Position 1 = 29, Position 2 = 31
Branch analysis from position: 29
1 jumps found. (Code = 42) Position 1 = 32
Branch analysis from position: 32
2 jumps found. (Code = 43) Position 1 = 35, Position 2 = 37
Branch analysis from position: 35
1 jumps found. (Code = 42) Position 1 = 38
Branch analysis from position: 38
1 jumps found. (Code = 42) Position 1 = 24
Branch analysis from position: 24
Branch analysis from position: 37
1 jumps found. (Code = 42) Position 1 = 24
Branch analysis from position: 24
Branch analysis from position: 31
2 jumps found. (Code = 43) Position 1 = 35, Position 2 = 37
Branch analysis from position: 35
Branch analysis from position: 37
Branch analysis from position: 42
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 42
filename:       /in/0DHOZ
function name:  r
number of ops:  45
compiled vars:  !0 = $m, !1 = $z, !2 = $ls, !3 = $i, !4 = $a, !5 = $l, !6 = $y
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   RECV                                             !0      
   18     1        INIT_FCALL                                               'strpos'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 '%2F%5C'
          4        DO_ICALL                                         $7      
          5        ASSIGN                                                   !1, $7
   19     6        INIT_FCALL                                               'strrpos'
          7        INIT_FCALL                                               'substr'
          8        SEND_VAR                                                 !0
          9        SEND_VAL                                                 0
         10        SEND_VAR                                                 !1
         11        DO_ICALL                                         $9      
         12        SEND_VAR                                                 $9
         13        SEND_VAL                                                 '%0A'
         14        DO_ICALL                                         $10     
         15        ASSIGN_OP                                     2          !1, $10
   20    16        INIT_FCALL                                               'explode'
         17        SEND_VAL                                                 '%0A'
         18        SEND_VAR                                                 !0
         19        DO_ICALL                                         $12     
         20        ASSIGN                                                   !2, $12
         21        ASSIGN                                                   !3, 0
   21    22        ASSIGN                                                   !4, <array>
   22    23      > FE_RESET_R                                       $16     !2, ->42
         24    > > FE_FETCH_R                                               $16, !5, ->42
   23    25    >   COUNT                                            ~17     !2
         26        DIV                                              ~18     ~17, 2
         27        IS_SMALLER                                               !3, ~18
         28      > JMPZ                                                     ~19, ->31
         29    >   QM_ASSIGN                                        ~20     0
         30      > JMP                                                      ->32
         31    >   QM_ASSIGN                                        ~20     1
         32    >   ASSIGN                                                   !6, ~20
         33        ADD                                              ~22     !6, 1
         34      > JMPZ                                                     !6, ->37
         35    >   QM_ASSIGN                                        ~23     2
         36      > JMP                                                      ->38
         37    >   QM_ASSIGN                                        ~23     1
         38    >   ADD                                              ~24     ~22, ~23
         39        ECHO                                                     ~24
   28    40        PRE_INC                                                  !3
   22    41      > JMP                                                      ->24
         42    >   FE_FREE                                                  $16
   30    43      > RETURN                                                   !4
   31    44*     > RETURN                                                   null

End of function r

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
166.45 ms | 1400 KiB | 23 Q