3v4l.org

run code in 500+ PHP versions simultaneously
<?php // Create an in-memory SQLite database $db = new PDO('sqlite::memory:', null, null, [ PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION ]); $count = 10; // Measure time to insert $count integers $startInsert = microtime(true); $db->exec("CREATE TABLE numbers (id INTEGER PRIMARY KEY AUTOINCREMENT, value INTEGER NOT NULL)"); for ($i = 1; $i <= $count; $i++) { $db->exec("INSERT INTO numbers (value) VALUES ($i)"); } $insertTime = microtime(true) - $startInsert; $stmt = $db->query("SELECT sum(id) FROM numbers"); $records = $stmt->fetchAll(PDO::FETCH_COLUMN); print_r($records); // 55
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 24
Branch analysis from position: 24
2 jumps found. (Code = 44) Position 1 = 26, Position 2 = 17
Branch analysis from position: 26
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
2 jumps found. (Code = 44) Position 1 = 26, Position 2 = 17
Branch analysis from position: 26
Branch analysis from position: 17
filename:       /in/VkfuV
function name:  (null)
number of ops:  43
compiled vars:  !0 = $db, !1 = $count, !2 = $startInsert, !3 = $i, !4 = $insertTime, !5 = $stmt, !6 = $records
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   NEW                                                  $7      'PDO'
          1        SEND_VAL_EX                                                  'sqlite%3A%3Amemory%3A'
          2        SEND_VAL_EX                                                  null
          3        SEND_VAL_EX                                                  null
    4     4        SEND_VAL_EX                                                  <array>
    3     5        DO_FCALL                                          0          
          6        ASSIGN                                                       !0, $7
    7     7        ASSIGN                                                       !1, 10
   10     8        INIT_FCALL                                                   'microtime'
          9        SEND_VAL                                                     <true>
         10        DO_ICALL                                             $11     
         11        ASSIGN                                                       !2, $11
   11    12        INIT_METHOD_CALL                                             !0, 'exec'
         13        SEND_VAL_EX                                                  'CREATE+TABLE+numbers+%28id+INTEGER+PRIMARY+KEY+AUTOINCREMENT%2C+value+INTEGER+NOT+NULL%29'
         14        DO_FCALL                                          0          
   13    15        ASSIGN                                                       !3, 1
         16      > JMP                                                          ->24
   14    17    >   INIT_METHOD_CALL                                             !0, 'exec'
         18        ROPE_INIT                                         3  ~16     'INSERT+INTO+numbers+%28value%29+VALUES+%28'
         19        ROPE_ADD                                          1  ~16     ~16, !3
         20        ROPE_END                                          2  ~15     ~16, '%29'
         21        SEND_VAL_EX                                                  ~15
         22        DO_FCALL                                          0          
   13    23        PRE_INC                                                      !3
         24    >   IS_SMALLER_OR_EQUAL                                          !3, !1
         25      > JMPNZ                                                        ~20, ->17
   16    26    >   INIT_FCALL                                                   'microtime'
         27        SEND_VAL                                                     <true>
         28        DO_ICALL                                             $21     
         29        SUB                                                  ~22     $21, !2
         30        ASSIGN                                                       !4, ~22
   18    31        INIT_METHOD_CALL                                             !0, 'query'
         32        SEND_VAL_EX                                                  'SELECT+sum%28id%29+FROM+numbers'
         33        DO_FCALL                                          0  $24     
         34        ASSIGN                                                       !5, $24
   19    35        INIT_METHOD_CALL                                             !5, 'fetchAll'
         36        SEND_VAL_EX                                                  7
         37        DO_FCALL                                          0  $26     
         38        ASSIGN                                                       !6, $26
   20    39        INIT_FCALL                                                   'print_r'
         40        SEND_VAR                                                     !6
         41        DO_ICALL                                                     
         42      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
168.04 ms | 1113 KiB | 15 Q