3v4l.org

run code in 300+ PHP versions simultaneously
<?php $input = 'tacocat'; $code = ''; var_dump((function() { return 1; })()); 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 .= "\n"; //$code .= sprintf('$input[ - %u]', $i); } //for ($i = strlen($input) - 1; $i >= 0; $i--) { // $code .= ($code ? '.' : '') . sprintf('$input[%s]', $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 = 27
Branch analysis from position: 27
2 jumps found. (Code = 44) Position 1 = 29, Position 2 = 10
Branch analysis from position: 29
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 13
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
2 jumps found. (Code = 44) Position 1 = 29, Position 2 = 10
Branch analysis from position: 29
Branch analysis from position: 10
Branch analysis from position: 13
2 jumps found. (Code = 44) Position 1 = 29, Position 2 = 10
Branch analysis from position: 29
Branch analysis from position: 10
filename:       /in/9At7d
function name:  (null)
number of ops:  42
compiled vars:  !0 = $input, !1 = $code, !2 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'tacocat'
    4     1        ASSIGN                                                   !1, ''
    6     2        INIT_FCALL                                               'var_dump'
          3        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2F9At7d%3A6%240'
          4        INIT_DYNAMIC_CALL                                        ~5
          5        DO_FCALL                                      0  $6      
          6        SEND_VAR                                                 $6
          7        DO_ICALL                                                 
    8     8        ASSIGN                                                   !2, 0
          9      > JMP                                                      ->27
    9    10    > > JMPZ                                                     !1, ->13
         11    >   QM_ASSIGN                                        ~9      '.'
         12      > JMP                                                      ->14
         13    >   QM_ASSIGN                                        ~9      ''
         14    >   ASSIGN_OP                                     8          !1, ~9
   10    15        INIT_FCALL                                               'sprintf'
         16        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'
         17        INIT_FCALL                                               'var_export'
         18        SEND_VAR                                                 !0
         19        SEND_VAL                                                 <true>
         20        DO_ICALL                                         $11     
         21        SEND_VAR                                                 $11
         22        SEND_VAR                                                 !2
         23        DO_ICALL                                         $12     
         24        ASSIGN_OP                                     8          !1, $12
   11    25        ASSIGN_OP                                     8          !1, '%0A'
    8    26        PRE_INC                                                  !2
         27    >   ISSET_ISEMPTY_DIM_OBJ                         0          !0, !2
         28      > JMPNZ                                                    ~16, ->10
   19    29    >   INIT_FCALL                                               'sprintf'
         30        SEND_VAL                                                 'return+%25s%3B'
         31        SEND_VAR                                                 !1
         32        DO_ICALL                                         $17     
         33        ASSIGN                                                   !1, $17
   21    34        INIT_FCALL                                               'var_dump'
         35        SEND_VAR                                                 !1
         36        DO_ICALL                                                 
   22    37        INIT_FCALL                                               'var_dump'
         38        INCLUDE_OR_EVAL                                  $20     !1, EVAL
         39        SEND_VAR                                                 $20
         40        DO_ICALL                                                 
         41      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2F9At7d%3A6%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9At7d
function name:  {closure}
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E > > RETURN                                                   1
          1*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2F9At7d%3A6%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
167.64 ms | 945 KiB | 20 Q