3v4l.org

run code in 300+ PHP versions simultaneously
<?php class x { public $a = [ '~.~' => '$this->waa($0);' ]; function p($s) { foreach($this->a as $p => $r) { $s = preg_replace_callback($p, function($m) use ($s){ $c = preg_replace('~\$(\d)~', '$m[$1]', $s); print "\n$c\n"; return eval($c); }, $s); } return $s; } function waa($t){ return '*'.$t.'*'; } } var_dump((new x)->p('wazup'));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/tFM1V
function name:  (null)
number of ops:  9
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   27     0  E >   INIT_FCALL                                               'var_dump'
          1        NEW                                              $0      'x'
          2        DO_FCALL                                      0          
          3        INIT_METHOD_CALL                                         $0, 'p'
          4        SEND_VAL_EX                                              'wazup'
          5        DO_FCALL                                      0  $2      
          6        SEND_VAR                                                 $2
          7        DO_ICALL                                                 
          8      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FtFM1V%3A13%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/tFM1V
function name:  {closure}
number of ops:  15
compiled vars:  !0 = $m, !1 = $s, !2 = $c
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
   14     2        INIT_FCALL                                               'preg_replace'
          3        SEND_VAL                                                 '%7E%5C%24%28%5Cd%29%7E'
          4        SEND_VAL                                                 '%24m%5B%241%5D'
          5        SEND_VAR                                                 !1
          6        DO_ICALL                                         $3      
          7        ASSIGN                                                   !2, $3
   15     8        ROPE_INIT                                     3  ~6      '%0A'
          9        ROPE_ADD                                      1  ~6      ~6, !2
         10        ROPE_END                                      2  ~5      ~6, '%0A'
         11        ECHO                                                     ~5
   17    12        INCLUDE_OR_EVAL                                  $8      !2, EVAL
         13      > RETURN                                                   $8
   18    14*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FtFM1V%3A13%240

Class x:
Function p:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 14
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 14
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
filename:       /in/tFM1V
function name:  p
number of ops:  17
compiled vars:  !0 = $s, !1 = $r, !2 = $p
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
   11     1        FETCH_OBJ_R                                      ~3      'a'
          2      > FE_RESET_R                                       $4      ~3, ->14
          3    > > FE_FETCH_R                                       ~5      $4, !1, ->14
          4    >   ASSIGN                                                   !2, ~5
   13     5        INIT_FCALL                                               'preg_replace_callback'
          6        SEND_VAR                                                 !2
          7        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FtFM1V%3A13%240'
          8        BIND_LEXICAL                                             ~7, !0
   18     9        SEND_VAL                                                 ~7
         10        SEND_VAR                                                 !0
         11        DO_ICALL                                         $8      
   13    12        ASSIGN                                                   !0, $8
   11    13      > JMP                                                      ->3
         14    >   FE_FREE                                                  $4
   21    15      > RETURN                                                   !0
   22    16*     > RETURN                                                   null

End of function p

Function waa:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/tFM1V
function name:  waa
number of ops:  5
compiled vars:  !0 = $t
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   24     0  E >   RECV                                             !0      
          1        CONCAT                                           ~1      '%2A', !0
          2        CONCAT                                           ~2      ~1, '%2A'
          3      > RETURN                                                   ~2
          4*     > RETURN                                                   null

End of function waa

End of class x.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.16 ms | 1400 KiB | 19 Q