3v4l.org

run code in 300+ PHP versions simultaneously
<?php function test($input){ $len = count($input); for($a = 0; $a < $len; $a++){ for($b = 0; $b < $len; $b++){ if($input[$a] === strrev($input[$b]) || $input[$b] === strrev($input[$a]) && $input[$a] === $input[$b]){ $str = $input[$b]; $pos = ceil(strlen($str) / 2) - 1; return $b." ".substr($str, $pos, 1); } } } } $input = array("abc", "def", "feg", "cba"); echo test($input)."\n"; ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/D71t9
function name:  (null)
number of ops:  7
compiled vars:  !0 = $input
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   ASSIGN                                                   !0, <array>
   15     1        INIT_FCALL                                               'test'
          2        SEND_VAR                                                 !0
          3        DO_FCALL                                      0  $2      
          4        CONCAT                                           ~3      $2, '%0A'
          5        ECHO                                                     ~3
   16     6      > RETURN                                                   1

Function test:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 48
Branch analysis from position: 48
2 jumps found. (Code = 44) Position 1 = 50, Position 2 = 5
Branch analysis from position: 50
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 45
Branch analysis from position: 45
2 jumps found. (Code = 44) Position 1 = 47, Position 2 = 7
Branch analysis from position: 47
2 jumps found. (Code = 44) Position 1 = 50, Position 2 = 5
Branch analysis from position: 50
Branch analysis from position: 5
Branch analysis from position: 7
2 jumps found. (Code = 47) Position 1 = 14, Position 2 = 26
Branch analysis from position: 14
2 jumps found. (Code = 46) Position 1 = 21, Position 2 = 25
Branch analysis from position: 21
2 jumps found. (Code = 43) Position 1 = 27, Position 2 = 44
Branch analysis from position: 27
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 44
2 jumps found. (Code = 44) Position 1 = 47, Position 2 = 7
Branch analysis from position: 47
Branch analysis from position: 7
Branch analysis from position: 25
Branch analysis from position: 26
filename:       /in/D71t9
function name:  test
number of ops:  51
compiled vars:  !0 = $input, !1 = $len, !2 = $a, !3 = $b, !4 = $str, !5 = $pos
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
    3     1        COUNT                                            ~6      !0
          2        ASSIGN                                                   !1, ~6
    4     3        ASSIGN                                                   !2, 0
          4      > JMP                                                      ->48
    5     5    >   ASSIGN                                                   !3, 0
          6      > JMP                                                      ->45
    6     7    >   FETCH_DIM_R                                      ~10     !0, !2
          8        INIT_FCALL                                               'strrev'
          9        FETCH_DIM_R                                      ~11     !0, !3
         10        SEND_VAL                                                 ~11
         11        DO_ICALL                                         $12     
         12        IS_IDENTICAL                                     ~13     $12, ~10
         13      > JMPNZ_EX                                         ~13     ~13, ->26
         14    >   FETCH_DIM_R                                      ~14     !0, !3
         15        INIT_FCALL                                               'strrev'
         16        FETCH_DIM_R                                      ~15     !0, !2
         17        SEND_VAL                                                 ~15
         18        DO_ICALL                                         $16     
         19        IS_IDENTICAL                                     ~17     $16, ~14
         20      > JMPZ_EX                                          ~17     ~17, ->25
         21    >   FETCH_DIM_R                                      ~18     !0, !2
         22        FETCH_DIM_R                                      ~19     !0, !3
         23        IS_IDENTICAL                                     ~20     ~18, ~19
         24        BOOL                                             ~17     ~20
         25    >   BOOL                                             ~13     ~17
         26    > > JMPZ                                                     ~13, ->44
    7    27    >   FETCH_DIM_R                                      ~21     !0, !3
         28        ASSIGN                                                   !4, ~21
    8    29        INIT_FCALL                                               'ceil'
         30        STRLEN                                           ~23     !4
         31        DIV                                              ~24     ~23, 2
         32        SEND_VAL                                                 ~24
         33        DO_ICALL                                         $25     
         34        SUB                                              ~26     $25, 1
         35        ASSIGN                                                   !5, ~26
    9    36        CONCAT                                           ~28     !3, '+'
         37        INIT_FCALL                                               'substr'
         38        SEND_VAR                                                 !4
         39        SEND_VAR                                                 !5
         40        SEND_VAL                                                 1
         41        DO_ICALL                                         $29     
         42        CONCAT                                           ~30     ~28, $29
         43      > RETURN                                                   ~30
    5    44    >   PRE_INC                                                  !3
         45    >   IS_SMALLER                                               !3, !1
         46      > JMPNZ                                                    ~32, ->7
    4    47    >   PRE_INC                                                  !2
         48    >   IS_SMALLER                                               !2, !1
         49      > JMPNZ                                                    ~34, ->5
   13    50    > > RETURN                                                   null

End of function test

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
167.58 ms | 1407 KiB | 20 Q