3v4l.org

run code in 300+ PHP versions simultaneously
<?php class X{ function test(){ return new class(){ protected function __construct(){} }; } } $x = new X; var_dump($c = $x->test()); $class = get_class($c); new $class;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/lABrL
function name:  (null)
number of ops:  16
compiled vars:  !0 = $x, !1 = $c, !2 = $class
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   NEW                                              $3      'X'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $3
   13     3        INIT_FCALL                                               'var_dump'
          4        INIT_METHOD_CALL                                         !0, 'test'
          5        DO_FCALL                                      0  $6      
          6        ASSIGN                                           ~7      !1, $6
          7        SEND_VAL                                                 ~7
          8        DO_ICALL                                                 
   14     9        GET_CLASS                                        ~9      !1
         10        ASSIGN                                                   !2, ~9
   15    11        FETCH_CLASS                                   0  $11     !2
         12        NEW                                              $12     $11
         13        DO_FCALL                                      0          
         14        FREE                                                     $12
         15      > RETURN                                                   1

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

End of function __construct

End of class class@anonymous.

Class X:
Function test:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/lABrL
function name:  test
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   DECLARE_ANON_CLASS                               9.88131e-324    
          1        NEW                                              $1      $0
          2        DO_FCALL                                      0          
          3      > RETURN                                                   $1
    8     4*     > RETURN                                                   null

End of function test

End of class X.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
171.42 ms | 1395 KiB | 15 Q