3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a= array("------------", "------------", "-L----------", "------------", "------------", "------------"); foreach ($a as $k => $v) { if ($p = strpos($v, 'L')) { $res[] = [$k, $p]; } if ($p = strpos($v, 'M')) { $res[] = [$k, $p]; } if ($p = strpos($v, 'R')) { $res[] = [$k, $p]; } } print_r($res);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 35
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 35
Branch analysis from position: 3
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 14
Branch analysis from position: 10
2 jumps found. (Code = 43) Position 1 = 20, Position 2 = 24
Branch analysis from position: 20
2 jumps found. (Code = 43) Position 1 = 30, Position 2 = 34
Branch analysis from position: 30
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 34
Branch analysis from position: 24
Branch analysis from position: 14
Branch analysis from position: 35
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 35
filename:       /in/lIBAl
function name:  (null)
number of ops:  40
compiled vars:  !0 = $a, !1 = $v, !2 = $k, !3 = $p, !4 = $res
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    5     1      > FE_RESET_R                                       $6      !0, ->35
          2    > > FE_FETCH_R                                       ~7      $6, !1, ->35
          3    >   ASSIGN                                                   !2, ~7
    6     4        INIT_FCALL                                               'strpos'
          5        SEND_VAR                                                 !1
          6        SEND_VAL                                                 'L'
          7        DO_ICALL                                         $9      
          8        ASSIGN                                           ~10     !3, $9
          9      > JMPZ                                                     ~10, ->14
    7    10    >   INIT_ARRAY                                       ~12     !2
         11        ADD_ARRAY_ELEMENT                                ~12     !3
         12        ASSIGN_DIM                                               !4
         13        OP_DATA                                                  ~12
   10    14    >   INIT_FCALL                                               'strpos'
         15        SEND_VAR                                                 !1
         16        SEND_VAL                                                 'M'
         17        DO_ICALL                                         $13     
         18        ASSIGN                                           ~14     !3, $13
         19      > JMPZ                                                     ~14, ->24
   11    20    >   INIT_ARRAY                                       ~16     !2
         21        ADD_ARRAY_ELEMENT                                ~16     !3
         22        ASSIGN_DIM                                               !4
         23        OP_DATA                                                  ~16
   14    24    >   INIT_FCALL                                               'strpos'
         25        SEND_VAR                                                 !1
         26        SEND_VAL                                                 'R'
         27        DO_ICALL                                         $17     
         28        ASSIGN                                           ~18     !3, $17
         29      > JMPZ                                                     ~18, ->34
   15    30    >   INIT_ARRAY                                       ~20     !2
         31        ADD_ARRAY_ELEMENT                                ~20     !3
         32        ASSIGN_DIM                                               !4
         33        OP_DATA                                                  ~20
    5    34    > > JMP                                                      ->2
         35    >   FE_FREE                                                  $6
   19    36        INIT_FCALL                                               'print_r'
         37        SEND_VAR                                                 !4
         38        DO_ICALL                                                 
         39      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
146.61 ms | 1400 KiB | 17 Q