3v4l.org

run code in 500+ PHP versions simultaneously
<?php class A {} class B {} class X { private function create(string $class): object { return new $class(); } public function createA(): A { return $this->create('A'); } public function createB(): B { return $this->create('B'); } } $test = new X; $new = $test->createB(); var_export($new);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5fECj
function name:  (null)
number of ops:  10
compiled vars:  !0 = $test, !1 = $new
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   24     0  E >   NEW                                                  $2      'X'
          1        DO_FCALL                                          0          
          2        ASSIGN                                                       !0, $2
   25     3        INIT_METHOD_CALL                                             !0, 'createB'
          4        DO_FCALL                                          0  $5      
          5        ASSIGN                                                       !1, $5
   26     6        INIT_FCALL                                                   'var_export'
          7        SEND_VAR                                                     !1
          8        DO_ICALL                                                     
          9      > RETURN                                                       1

Class A: [no user functions]
Class B: [no user functions]
Class X:
Function create:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5fECj
function name:  create
number of ops:  8
compiled vars:  !0 = $class
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    8     0  E >   RECV                                                 !0      
   10     1        FETCH_CLASS                                       0  $1      !0
          2        NEW                                                  $2      $1
          3        DO_FCALL                                          0          
          4        VERIFY_RETURN_TYPE                                           $2
          5      > RETURN                                                       $2
   11     6*       VERIFY_RETURN_TYPE                                           
          7*     > RETURN                                                       null

End of function create

Function createa:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5fECj
function name:  createA
number of ops:  7
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   15     0  E >   INIT_METHOD_CALL                                             'create'
          1        SEND_VAL                                                     'A'
          2        DO_FCALL                                          0  $0      
          3        VERIFY_RETURN_TYPE                                           $0
          4      > RETURN                                                       $0
   16     5*       VERIFY_RETURN_TYPE                                           
          6*     > RETURN                                                       null

End of function createa

Function createb:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5fECj
function name:  createB
number of ops:  7
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   20     0  E >   INIT_METHOD_CALL                                             'create'
          1        SEND_VAL                                                     'B'
          2        DO_FCALL                                          0  $0      
          3        VERIFY_RETURN_TYPE                                           $0
          4      > RETURN                                                       $0
   21     5*       VERIFY_RETURN_TYPE                                           
          6*     > RETURN                                                       null

End of function createb

End of class X.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
191 ms | 1717 KiB | 14 Q