3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { public function x(): int { return 5; } } $cl = get_class(new class() { public function x(): int { return 6; } }); $createProxy = function(string $class): string { $resName = 'Proxy_' . md5($class); class_alias($class, $resName . '_alias'); eval('class ' . $resName . ' extends ' . $resName . '_alias { public function x(): int { return 7; } }'); return $resName; }; $proxyCl = $createProxy($cl); var_dump((new $cl)->x()); var_dump((new $proxyCl)->x());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/NoPDi
function name:  (null)
number of ops:  28
compiled vars:  !0 = $cl, !1 = $createProxy, !2 = $proxyCl
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   DECLARE_ANON_CLASS                               <unknown> 
          1        NEW                                              $4      $3
          2        DO_FCALL                                      0          
          3        GET_CLASS                                        ~6      $4
          4        ASSIGN                                                   !0, ~6
   18     5        DECLARE_LAMBDA_FUNCTION                          ~8      [0]
          6        ASSIGN                                                   !1, ~8
   32     7        INIT_DYNAMIC_CALL                                        !1
          8        SEND_VAR_EX                                              !0
          9        DO_FCALL                                      0  $10     
         10        ASSIGN                                                   !2, $10
   34    11        INIT_FCALL                                               'var_dump'
         12        FETCH_CLASS                                   0  $12     !0
         13        NEW                                              $13     $12
         14        DO_FCALL                                      0          
         15        INIT_METHOD_CALL                                         $13, 'x'
         16        DO_FCALL                                      0  $15     
         17        SEND_VAR                                                 $15
         18        DO_ICALL                                                 
   35    19        INIT_FCALL                                               'var_dump'
         20        FETCH_CLASS                                   0  $17     !2
         21        NEW                                              $18     $17
         22        DO_FCALL                                      0          
         23        INIT_METHOD_CALL                                         $18, 'x'
         24        DO_FCALL                                      0  $20     
         25        SEND_VAR                                                 $20
         26        DO_ICALL                                                 
         27      > RETURN                                                   1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/NoPDi
function name:  {closure}
number of ops:  20
compiled vars:  !0 = $class, !1 = $resName
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   RECV                                             !0      
   19     1        INIT_FCALL                                               'md5'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $2      
          4        CONCAT                                           ~3      'Proxy_', $2
          5        ASSIGN                                                   !1, ~3
   20     6        INIT_FCALL                                               'class_alias'
          7        SEND_VAR                                                 !0
          8        CONCAT                                           ~5      !1, '_alias'
          9        SEND_VAL                                                 ~5
         10        DO_ICALL                                                 
   21    11        CONCAT                                           ~7      'class+', !1
         12        CONCAT                                           ~8      ~7, '+extends+'
         13        CONCAT                                           ~9      ~8, !1
         14        CONCAT                                           ~10     ~9, '_alias%0A++++%7B%0A++++++++public+function+x%28%29%3A+int%0A++++++++%7B%0A++++++++++++return+7%3B%0A++++++++%7D%0A++++%7D'
         15        INCLUDE_OR_EVAL                                          ~10, EVAL
   29    16        VERIFY_RETURN_TYPE                                       !1
         17      > RETURN                                                   !1
   30    18*       VERIFY_RETURN_TYPE                                       
         19*     > RETURN                                                   null

End of Dynamic Function 0

Class A:
Function x:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/NoPDi
function name:  x
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E > > RETURN                                                   5
    8     1*       VERIFY_RETURN_TYPE                                       
          2*     > RETURN                                                   null

End of function x

End of class A.

Class class@anonymous:
Function x:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/NoPDi
function name:  x
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E > > RETURN                                                   6
   15     1*       VERIFY_RETURN_TYPE                                       
          2*     > RETURN                                                   null

End of function x

End of class class@anonymous.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
139.58 ms | 1005 KiB | 16 Q