3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A {} class D { protected function test1() { echo "called\n"; return 'BLAH'; } public function test($class_name) { return new $class_name($this->test1()); } } $D = new D; var_dump($D->test('A')); var_dump($D->test('D')); var_dump($D->test('C'));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/I8SrW
function name:  (null)
number of ops:  22
compiled vars:  !0 = $D
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   NEW                                              $1      'D'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   20     3        INIT_FCALL                                               'var_dump'
          4        INIT_METHOD_CALL                                         !0, 'test'
          5        SEND_VAL_EX                                              'A'
          6        DO_FCALL                                      0  $4      
          7        SEND_VAR                                                 $4
          8        DO_ICALL                                                 
   21     9        INIT_FCALL                                               'var_dump'
         10        INIT_METHOD_CALL                                         !0, 'test'
         11        SEND_VAL_EX                                              'D'
         12        DO_FCALL                                      0  $6      
         13        SEND_VAR                                                 $6
         14        DO_ICALL                                                 
   22    15        INIT_FCALL                                               'var_dump'
         16        INIT_METHOD_CALL                                         !0, 'test'
         17        SEND_VAL_EX                                              'C'
         18        DO_FCALL                                      0  $8      
         19        SEND_VAR                                                 $8
         20        DO_ICALL                                                 
         21      > RETURN                                                   1

Class A: [no user functions]
Class D:
Function test1:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/I8SrW
function name:  test1
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   ECHO                                                     'called%0A'
   10     1      > RETURN                                                   'BLAH'
   11     2*     > RETURN                                                   null

End of function test1

Function test:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/I8SrW
function name:  test
number of ops:  9
compiled vars:  !0 = $class_name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   RECV                                             !0      
   15     1        FETCH_CLASS                                   0  $1      !0
          2        NEW                                              $2      $1
          3        INIT_METHOD_CALL                                         'test1'
          4        DO_FCALL                                      0  $3      
          5        SEND_VAR_NO_REF_EX                                       $3
          6        DO_FCALL                                      0          
          7      > RETURN                                                   $2
   16     8*     > RETURN                                                   null

End of function test

End of class D.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.13 ms | 1388 KiB | 15 Q