3v4l.org

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

Function %00%7Bclosure%7D%2Fin%2Fc9ITE0x7f51537bd22a:
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = -2
filename:       /in/c9ITE
function name:  {closure}
number of ops:  16
compiled vars:  !0 = $m, !1 = $s, !2 = $r
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  16     0  E >   RECV                                             !0      
         1        FETCH_R                      static              $3      's'
         2        ASSIGN                                                   !1, $3
         3        FETCH_R                      static              $5      'r'
         4        ASSIGN                                                   !2, $5
  17     5        INIT_FCALL                                               'preg_replace_callback'
         6        SEND_VAL                                                 '%7E%5C%24%28%5Cd%29%7E'
         7        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2Fc9ITE0x7f51537bd20d'
         8        SEND_VAL                                                 ~7
         9        SEND_VAR                                                 !2
        10        DO_ICALL                                         $8      
        11        CONCAT                                           ~9      'return+', $8
        12        CONCAT                                           ~10     ~9, '%3B'
        13        INCLUDE_OR_EVAL                                  $11     ~10, EVAL
        14      > RETURN                                                   $11
  18    15*     > RETURN                                                   null

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

Function %00%7Bclosure%7D%2Fin%2Fc9ITE0x7f51537bd20d:
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = -2
filename:       /in/c9ITE
function name:  {closure}
number of ops:  7
compiled vars:  !0 = $i, !1 = $m
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  17     0  E >   RECV                                             !0      
         1        FETCH_R                      static              $2      'm'
         2        ASSIGN                                                   !1, $2
         3        FETCH_DIM_R                                      $4      !0, 1
         4        FETCH_DIM_R                                      $5      !1, $4
         5      > RETURN                                                   $5
         6*     > RETURN                                                   null

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

Class x:
Function p:
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = 3, Position 2 = 33
Branch analysis from position: 3
Jump found. Position 1 = 4, Position 2 = 33
Branch analysis from position: 4
Jump found. Position 1 = 11, Position 2 = 26
Branch analysis from position: 11
Jump found. Position 1 = 32
Branch analysis from position: 32
Jump found. Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 26
Jump found. Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 33
Jump found. Position 1 = -2
Branch analysis from position: 33
filename:       /in/c9ITE
function name:  p
number of ops:  36
compiled vars:  !0 = $s, !1 = $r, !2 = $p, !3 = $m, !4 = $string
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   9     0  E >   RECV                                             !0      
  11     1        FETCH_OBJ_R                                      $5      'a'
         2      > FE_RESET_R                                       $6      $5, ->33
         3    > > FE_FETCH_R                                       ~7      $6, !1, ->33
         4    >   ASSIGN                                                   !2, ~7
  14     5        INIT_FCALL                                               'preg_match'
         6        SEND_VAL                                                 '%7E%5E%28.%2A%29%28%5B%2F%5C%7E%5D%29%28%5BimsxADSUXJu%5D%2A%29e%28%5BimsxADSUXJu%5D%2A%29%24%7Es'
         7        SEND_VAR                                                 !2
         8        SEND_REF                                                 !3
         9        DO_ICALL                                         $9      
        10      > JMPZ                                                     $9, ->26
  16    11    >   INIT_FCALL                                               'preg_replace_callback'
        12        FETCH_DIM_R                                      $10     !3, 1
        13        FETCH_DIM_R                                      $11     !3, 2
        14        CONCAT                                           ~12     $10, $11
        15        FETCH_DIM_R                                      $13     !3, 3
        16        CONCAT                                           ~14     ~12, $13
        17        FETCH_DIM_R                                      $15     !3, 4
        18        CONCAT                                           ~16     ~14, $15
        19        SEND_VAL                                                 ~16
        20        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2Fc9ITE0x7f51537bd22a'
  18    21        SEND_VAL                                                 ~17
        22        SEND_VAR                                                 !0
        23        DO_ICALL                                         $18     
        24        ASSIGN                                                   !0, $18
        25      > JMP                                                      ->32
  20    26    >   INIT_FCALL                                               'preg_replace'
        27        SEND_VAR                                                 !2
        28        SEND_VAR                                                 !1
        29        SEND_VAR                                                 !0
        30        DO_ICALL                                         $20     
        31        ASSIGN                                                   !4, $20
        32    > > JMP                                                      ->3
        33    >   FE_FREE                                                  $6
  23    34      > RETURN                                                   !0
  24    35*     > RETURN                                                   null

End of function p

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