3v4l.org

run code in 300+ 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"); 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/vkkUG
function name:  (null)
number of ops:  13
compiled vars:  !0 = $db
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   NEW                                              $1      'SQLite3'
          1        SEND_VAL_EX                                              '%3Amemory'
          2        SEND_VAL_EX                                              6
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !0, $1
   14     5        INIT_METHOD_CALL                                         !0, 'query'
          6        SEND_VAL_EX                                              'CREATE+TABLE+test+%28foo%2C+bar%29'
          7        DO_FCALL                                      0          
   16     8        INIT_STATIC_METHOD_CALL                                  'test', 'getInstance'
          9        SEND_VAR                                                 !0
         10        DO_FCALL                                      0          
   17    11        ECHO                                                     'done'
         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/vkkUG
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/vkkUG
function name:  getInstance
number of ops:  13
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        ASSIGN                                                   !1, $2
    9     5        NEW                                              $4      'test'
          6        INIT_METHOD_CALL                                         !1, 'fetchArray'
          7        SEND_VAL_EX                                              1
          8        DO_FCALL                                      0  $5      
          9        SEND_VAR_NO_REF_EX                                       $5
         10        DO_FCALL                                      0          
         11      > RETURN                                                   $4
   10    12*     > RETURN                                                   null

End of function getinstance

End of class test.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
163.18 ms | 1396 KiB | 15 Q