3v4l.org

run code in 200+ PHP versions simultaneously
<?php class test { public function __construct(array $values) { print_r($values); } public static function getInstance($db) { $result = $db->query("SELECT * from test"); var_dump($result); return new test($result->fetchArray(SQLITE3_ASSOC)); } } $db = new SQLite3(":memory:", SQLITE3_OPEN_READWRITE | SQLITE3_OPEN_CREATE); $db->query("CREATE TABLE test (foo, bar)"); test::getInstance($db); print "done"; ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/UFnes
function name:  (null)
number of ops:  13
compiled vars:  !0 = $db
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  14     0  E >   NEW                                              $1      :21
         1        SEND_VAL_EX                                              '%3Amemory%3A'
         2        SEND_VAL_EX                                              6
         3        DO_FCALL                                      0          
         4        QM_ASSIGN                                                !0
  15     5        INIT_METHOD_CALL                                         !0, 'query'
         6        SEND_VAL_EX                                              'CREATE+TABLE+test+%28foo%2C+bar%29'
         7        DO_FCALL                                      0          
  17     8        INIT_STATIC_METHOD_CALL                                  'test', 'getInstance'
         9        SEND_VAR                                                 !0
        10        DO_FCALL                                      0          
  18    11        ASSIGN_OBJ                                               'done'
  19    12      > RETURN                                                   1

Class test:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/UFnes
function name:  __construct
number of ops:  5
compiled vars:  !0 = $values
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   3     0  E >   RECV                                             !0      
   4     1        INIT_FCALL                                               'print_r'
         2        SEND_VAR                                                 !0
         3        DO_ICALL                                                 
   5     4      > RETURN                                                   null

End of function __construct

Function getinstance:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/UFnes
function name:  getInstance
number of ops:  16
compiled vars:  !0 = $db, !1 = $result
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   7     0  E >   RECV                                             !0      
   8     1        INIT_METHOD_CALL                                         !0, 'query'
         2        SEND_VAL_EX                                              'SELECT+%2A+from+test'
         3        DO_FCALL                                      0  $2      
         4        QM_ASSIGN                                                !1
   9     5        INIT_FCALL                                               'var_dump'
         6        SEND_VAR                                                 !1
         7        DO_ICALL                                                 
  10     8        NEW                                              $5      :15
         9        INIT_METHOD_CALL                                         !1, 'fetchArray'
        10        SEND_VAL_EX                                              1
        11        DO_FCALL                                      0  $6      
        12        SEND_VAR_NO_REF_EX                                       $6
        13        DO_FCALL                                      0          
        14      > RETURN                                                   $5
  11    15*     > RETURN                                                   null

End of function getinstance

End of class test.

Generated using Vulcan Logic Dumper, using php 7.4.0