3v4l.org

run code in 300+ PHP versions simultaneously
<?php //simulatiing a similar situation class PDO2{} class DB{ public static function connection(){ //I know it's not something like this, but that isn't what we're concerned here return new class { public function getPdo(){ return new PDO2(); } }; } }; class Test { protected $pdo; public function __construct(PDO2 $pdo) { $this->pdo = $pdo; } } var_dump(new Test($pdo = DB::connection()->getPdo()));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/tNF0I
function name:  (null)
number of ops:  12
compiled vars:  !0 = $pdo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   31     0  E >   INIT_FCALL                                               'var_dump'
          1        NEW                                              $1      'Test'
          2        INIT_STATIC_METHOD_CALL                                  'DB', 'connection'
          3        DO_FCALL                                      0  $2      
          4        INIT_METHOD_CALL                                         $2, 'getPdo'
          5        DO_FCALL                                      0  $3      
          6        ASSIGN                                           ~4      !0, $3
          7        SEND_VAL_EX                                              ~4
          8        DO_FCALL                                      0          
          9        SEND_VAR                                                 $1
         10        DO_ICALL                                                 
         11      > RETURN                                                   1

Class PDO2: [no user functions]
Class class@anonymous:
Function getpdo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/tNF0I
function name:  getPdo
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   NEW                                              $0      'PDO2'
          1        DO_FCALL                                      0          
          2      > RETURN                                                   $0
   14     3*     > RETURN                                                   null

End of function getpdo

End of class class@anonymous.

Class DB:
Function connection:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/tNF0I
function name:  connection
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   DECLARE_ANON_CLASS                               <const ast>   
          1        NEW                                              $1      $0
          2        DO_FCALL                                      0          
          3      > RETURN                                                   $1
   16     4*     > RETURN                                                   null

End of function connection

End of class DB.

Class Test:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/tNF0I
function name:  __construct
number of ops:  4
compiled vars:  !0 = $pdo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   25     0  E >   RECV                                             !0      
   26     1        ASSIGN_OBJ                                               'pdo'
          2        OP_DATA                                                  !0
   28     3      > RETURN                                                   null

End of function __construct

End of class Test.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
174.81 ms | 1396 KiB | 15 Q