3v4l.org

run code in 300+ PHP versions simultaneously
<?php $db = new PDO('sqlite::memory:'); // These are the only reasonable settings to ever use: $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, false); $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); // Let's create a table: $db->exec("CREATE TABLE foo (username TEXT, pwhash TEXT, email TEXT)"); // Dummy rows: $db->exec("INSERT INTO foo(username, pwhash, email) VALUES ('scott', 'lolno', 'scott@paragonie.com')"); $db->exec("INSERT INTO foo(username, pwhash, email) VALUES ('robyn', 'fake!', 'robyn@paragonie.com')"); // Okay, now let's do a prepared statement, with an integer field $int = 12345; $stmt = $db->prepare("SELECT * FROM foo WHERE {$int} = ?"); $stmt->bindValue(1, $int, PDO::PARAM_INT); $stmt->execute(); var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/VL7UC
function name:  (null)
number of ops:  43
compiled vars:  !0 = $db, !1 = $int, !2 = $stmt
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   NEW                                              $3      'PDO'
          1        SEND_VAL_EX                                              'sqlite%3A%3Amemory%3A'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $3
    5     4        INIT_METHOD_CALL                                         !0, 'setAttribute'
          5        SEND_VAL_EX                                              20
          6        SEND_VAL_EX                                              <false>
          7        DO_FCALL                                      0          
    6     8        INIT_METHOD_CALL                                         !0, 'setAttribute'
          9        SEND_VAL_EX                                              3
         10        SEND_VAL_EX                                              2
         11        DO_FCALL                                      0          
    9    12        INIT_METHOD_CALL                                         !0, 'exec'
         13        SEND_VAL_EX                                              'CREATE+TABLE+foo+%28username+TEXT%2C+pwhash+TEXT%2C+email+TEXT%29'
         14        DO_FCALL                                      0          
   12    15        INIT_METHOD_CALL                                         !0, 'exec'
         16        SEND_VAL_EX                                              'INSERT+INTO+foo%28username%2C+pwhash%2C+email%29+VALUES+%28%27scott%27%2C%0A%27lolno%27%2C+%27scott%40paragonie.com%27%29'
         17        DO_FCALL                                      0          
   14    18        INIT_METHOD_CALL                                         !0, 'exec'
         19        SEND_VAL_EX                                              'INSERT+INTO+foo%28username%2C+pwhash%2C+email%29+VALUES+%28%27robyn%27%2C%0A%27fake%21%27%2C+%27robyn%40paragonie.com%27%29'
         20        DO_FCALL                                      0          
   18    21        ASSIGN                                                   !1, 12345
   20    22        INIT_METHOD_CALL                                         !0, 'prepare'
         23        ROPE_INIT                                     3  ~13     'SELECT+%2A+FROM+foo+WHERE+'
         24        ROPE_ADD                                      1  ~13     ~13, !1
         25        ROPE_END                                      2  ~12     ~13, '+%3D+%3F'
         26        SEND_VAL_EX                                              ~12
         27        DO_FCALL                                      0  $15     
         28        ASSIGN                                                   !2, $15
   21    29        INIT_METHOD_CALL                                         !2, 'bindValue'
         30        SEND_VAL_EX                                              1
         31        SEND_VAR_EX                                              !1
         32        SEND_VAL_EX                                              1
         33        DO_FCALL                                      0          
   22    34        INIT_METHOD_CALL                                         !2, 'execute'
         35        DO_FCALL                                      0          
   23    36        INIT_FCALL                                               'var_dump'
         37        INIT_METHOD_CALL                                         !2, 'fetchAll'
         38        SEND_VAL_EX                                              2
         39        DO_FCALL                                      0  $19     
         40        SEND_VAR                                                 $19
         41        DO_ICALL                                                 
         42      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.02 ms | 1450 KiB | 14 Q