3v4l.org

run code in 500+ PHP versions simultaneously
<?php function createAnonymousClass() { // This value goes away by the time the class would be instantiated a second time $value = []; $class = get_class(new class() { function foo() { // var_dump($^value); } }); unset($value); // $value is gone now return $class; } $class = createAnonymousClass(); var_dump(new $class); // Can't possibly hold a reference to $value var_dump(createAnonymousClass() === createAnonymousClass());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/2OcmP
function name:  (null)
number of ops:  18
compiled vars:  !0 = $class
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   17     0  E >   INIT_FCALL                                                   'createanonymousclass'
          1        DO_FCALL                                          0  $1      
          2        ASSIGN                                                       !0, $1
   18     3        INIT_FCALL                                                   'var_dump'
          4        FETCH_CLASS                                       0  $3      !0
          5        NEW                                                  $4      $3
          6        DO_FCALL                                          0          
          7        SEND_VAR                                                     $4
          8        DO_ICALL                                                     
   19     9        INIT_FCALL                                                   'var_dump'
         10        INIT_FCALL                                                   'createanonymousclass'
         11        DO_FCALL                                          0  $7      
         12        INIT_FCALL                                                   'createanonymousclass'
         13        DO_FCALL                                          0  $8      
         14        IS_IDENTICAL                                         ~9      $7, $8
         15        SEND_VAL                                                     ~9
         16        DO_ICALL                                                     
         17      > RETURN                                                       1

Function createanonymousclass:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/2OcmP
function name:  createAnonymousClass
number of ops:  9
compiled vars:  !0 = $value, !1 = $class
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    5     0  E >   ASSIGN                                                       !0, <array>
    6     1        DECLARE_ANON_CLASS                                   <unknown> 
          2        NEW                                                  $4      $3
          3        DO_FCALL                                          0          
          4        GET_CLASS                                            ~6      $4
          5        ASSIGN                                                       !1, ~6
   11     6        UNSET_CV                                                     !0
   14     7      > RETURN                                                       !1
   15     8*     > RETURN                                                       null

End of function createanonymousclass

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

End of function foo

End of class class@anonymous.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
173.29 ms | 1719 KiB | 17 Q