3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Test{} function returnTest(){return 'Test';} var_dump(new ${!${''} = 'Test'}); // string literal name works var_dump(new ${!${''} = returnTest()}); // function return value works var_dump(new ${!${''} = (new class() { // method invokation from anonymous function expression works function returnTest() : string{return 'Test';} })->returnTest()});
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/WnH2d
function name:  (null)
number of ops:  35
compiled vars:  !0 = $
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   INIT_FCALL                                               'var_dump'
          1        ASSIGN                                           ~1      !0, 'Test'
          2        BOOL_NOT                                         ~2      ~1
          3        FETCH_R                      local               ~3      ~2
          4        FETCH_CLASS                                   0  $4      ~3
          5        NEW                                              $5      $4
          6        DO_FCALL                                      0          
          7        SEND_VAR                                                 $5
          8        DO_ICALL                                                 
    8     9        INIT_FCALL                                               'var_dump'
         10        INIT_FCALL                                               'returntest'
         11        DO_FCALL                                      0  $8      
         12        ASSIGN                                           ~9      !0, $8
         13        BOOL_NOT                                         ~10     ~9
         14        FETCH_R                      local               ~11     ~10
         15        FETCH_CLASS                                   0  $12     ~11
         16        NEW                                              $13     $12
         17        DO_FCALL                                      0          
         18        SEND_VAR                                                 $13
         19        DO_ICALL                                                 
    9    20        INIT_FCALL                                               'var_dump'
         21        DECLARE_ANON_CLASS                               <resource>  
         22        NEW                                              $17     $16
         23        DO_FCALL                                      0          
   11    24        INIT_METHOD_CALL                                         $17, 'returnTest'
         25        DO_FCALL                                      0  $19     
    9    26        ASSIGN                                           ~20     !0, $19
         27        BOOL_NOT                                         ~21     ~20
         28        FETCH_R                      local               ~22     ~21
         29        FETCH_CLASS                                   0  $23     ~22
         30        NEW                                              $24     $23
         31        DO_FCALL                                      0          
         32        SEND_VAR                                                 $24
         33        DO_ICALL                                                 
   11    34      > RETURN                                                   1

Function returntest:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/WnH2d
function name:  returnTest
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E > > RETURN                                                   'Test'
          1*     > RETURN                                                   null

End of function returntest

Class Test: [no user functions]
Class class@anonymous:
Function returntest:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/WnH2d
function name:  returnTest
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E > > RETURN                                                   'Test'
          1*       VERIFY_RETURN_TYPE                                       
          2*     > RETURN                                                   null

End of function returntest

End of class class@anonymous.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
164.66 ms | 1403 KiB | 16 Q