3v4l.org

run code in 300+ PHP versions simultaneously
<?php $input = ''; $code = ''; for ($i = 0; isset($input[$i]); $i++) { $code .= $code ? '.' : ''; $code .= sprintf('(function($str, $pos) { $length = (function($str) { for ($l = 0; isset($str[$l]); $l++) {} return $l - 1; })($str); return $str[$length - $pos]; })(%s, %u)', var_export($input, true), $i); } $code = sprintf('return %s;', $code); var_dump($code); var_dump(eval($code));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 20
Branch analysis from position: 20
2 jumps found. (Code = 44) Position 1 = 22, Position 2 = 4
Branch analysis from position: 22
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 7
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
2 jumps found. (Code = 44) Position 1 = 22, Position 2 = 4
Branch analysis from position: 22
Branch analysis from position: 4
Branch analysis from position: 7
2 jumps found. (Code = 44) Position 1 = 22, Position 2 = 4
Branch analysis from position: 22
Branch analysis from position: 4
filename:       /in/X2KvA
function name:  (null)
number of ops:  35
compiled vars:  !0 = $input, !1 = $code, !2 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, ''
    4     1        ASSIGN                                                   !1, ''
    6     2        ASSIGN                                                   !2, 0
          3      > JMP                                                      ->20
    7     4    > > JMPZ                                                     !1, ->7
          5    >   QM_ASSIGN                                        ~6      '.'
          6      > JMP                                                      ->8
          7    >   QM_ASSIGN                                        ~6      ''
          8    >   ASSIGN_OP                                     8          !1, ~6
    8     9        INIT_FCALL                                               'sprintf'
         10        SEND_VAL                                                 '%28function%28%24str%2C+%24pos%29+%7B+%24length+%3D+%28function%28%24str%29+%7B+for+%28%24l+%3D+0%3B+isset%28%24str%5B%24l%5D%29%3B+%24l%2B%2B%29+%7B%7D+return+%24l+-+1%3B+%7D%29%28%24str%29%3B+return+%24str%5B%24length+-+%24pos%5D%3B+%7D%29%28%25s%2C+%25u%29'
         11        INIT_FCALL                                               'var_export'
         12        SEND_VAR                                                 !0
         13        SEND_VAL                                                 <true>
         14        DO_ICALL                                         $8      
         15        SEND_VAR                                                 $8
         16        SEND_VAR                                                 !2
         17        DO_ICALL                                         $9      
         18        ASSIGN_OP                                     8          !1, $9
    6    19        PRE_INC                                                  !2
         20    >   ISSET_ISEMPTY_DIM_OBJ                         0          !0, !2
         21      > JMPNZ                                                    ~12, ->4
   11    22    >   INIT_FCALL                                               'sprintf'
         23        SEND_VAL                                                 'return+%25s%3B'
         24        SEND_VAR                                                 !1
         25        DO_ICALL                                         $13     
         26        ASSIGN                                                   !1, $13
   13    27        INIT_FCALL                                               'var_dump'
         28        SEND_VAR                                                 !1
         29        DO_ICALL                                                 
   14    30        INIT_FCALL                                               'var_dump'
         31        INCLUDE_OR_EVAL                                  $16     !1, EVAL
         32        SEND_VAR                                                 $16
         33        DO_ICALL                                                 
         34      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.9 ms | 1392 KiB | 19 Q