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"); var_dump($result->fetchArray(SQLITE3_ASSOC)); return new test($result->fetchArray(SQLITE3_ASSOC)); } } $db = new SQLite3(":memory:", SQLITE3_OPEN_READWRITE | SQLITE3_OPEN_CREATE); $db->query("CREATE TABLE test (foo, bar)"); $db->query("INSERT INTO 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/CEBQX
function name:  (null)
number of ops:  16
compiled vars:  !0 = $db
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   NEW                                              $1      'SQLite3'
          1        SEND_VAL_EX                                              '%3Amemory%3A'
          2        SEND_VAL_EX                                              6
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !0, $1
   15     5        INIT_METHOD_CALL                                         !0, 'query'
          6        SEND_VAL_EX                                              'CREATE+TABLE+test+%28foo%2C+bar%29'
          7        DO_FCALL                                      0          
   16     8        INIT_METHOD_CALL                                         !0, 'query'
          9        SEND_VAL_EX                                              'INSERT+INTO+test+%28%27foo%27%2C+%27bar%27%29'
         10        DO_FCALL                                      0          
   18    11        INIT_STATIC_METHOD_CALL                                  'test', 'getInstance'
         12        SEND_VAR                                                 !0
         13        DO_FCALL                                      0          
   19    14        ECHO                                                     'done'
   20    15      > RETURN                                                   1

Class test:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CEBQX
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/CEBQX
function name:  getInstance
number of ops:  19
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        INIT_FCALL                                               'var_dump'
          6        INIT_METHOD_CALL                                         !1, 'fetchArray'
          7        SEND_VAL_EX                                              1
          8        DO_FCALL                                      0  $4      
          9        SEND_VAR                                                 $4
         10        DO_ICALL                                                 
   10    11        NEW                                              $6      'test'
         12        INIT_METHOD_CALL                                         !1, 'fetchArray'
         13        SEND_VAL_EX                                              1
         14        DO_FCALL                                      0  $7      
         15        SEND_VAR_NO_REF_EX                                       $7
         16        DO_FCALL                                      0          
         17      > RETURN                                                   $6
   11    18*     > RETURN                                                   null

End of function getinstance

End of class test.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
178.26 ms | 1400 KiB | 17 Q