3v4l.org

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

Function %00%7Bclosure%7D%2Fin%2FGJDmM0x7f5d393c515b:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/GJDmM
function name:  {closure}
number of ops:  10
compiled vars:  !0 = $m, !1 = $s
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  13     0  E >   RECV                                             !0      
         1        BIND_STATIC                                              !1, 's'
  15     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                                         $2      
         7        INCLUDE_OR_EVAL                                  $3      $2, EVAL
         8      > RETURN                                                   $3
  17     9*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FGJDmM0x7f5d393c515b

Class x:
Function __construct:
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/GJDmM
function name:  __construct
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%2FGJDmM0x7f5d393c515b'
         8        BIND_LEXICAL                                             ~7, !0
  17     9        SEND_VAL                                                 ~7
        10        SEND_VAR                                                 !0
        11        DO_ICALL                                         $8      
        12        ASSIGN                                                   !0, $8
        13      > JMP                                                      ->3
        14    >   FE_FREE                                                  $4
  20    15      > RETURN                                                   !0
  21    16*     > RETURN                                                   null

End of function __construct

Function waa:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/GJDmM
function name:  waa
number of ops:  5
compiled vars:  !0 = $t
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  23     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 7.3.0