3v4l.org

run code in 300+ PHP versions simultaneously
<?php class User { protected $db; public function __construct(PDO $db) { $this->db = $db; } public function doStuff() { // Access DB: $this->db; //->exec('Select ..."'); } } $db = new PDO('mysql:dbname=testdb;host=127.0.0.1', 'dbuser', 'dbpass'); $user = new User($db);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/qcZ1A
function name:  (null)
number of ops:  11
compiled vars:  !0 = $db, !1 = $user
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   NEW                                              $2      'PDO'
          1        SEND_VAL_EX                                              'mysql%3Adbname%3Dtestdb%3Bhost%3D127.0.0.1'
          2        SEND_VAL_EX                                              'dbuser'
          3        SEND_VAL_EX                                              'dbpass'
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !0, $2
   20     6        NEW                                              $5      'User'
          7        SEND_VAR_EX                                              !0
          8        DO_FCALL                                      0          
          9        ASSIGN                                                   !1, $5
         10      > RETURN                                                   1

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

End of function __construct

Function dostuff:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/qcZ1A
function name:  doStuff
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   FETCH_OBJ_R                                      ~0      'db'
          1        FREE                                                     ~0
   15     2      > RETURN                                                   null

End of function dostuff

End of class User.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
187.22 ms | 1394 KiB | 13 Q