3v4l.org

run code in 300+ PHP versions simultaneously
<?php try { $hostname = "localhost"; $dbname = "mydatabase"; $username = "myusername"; $pw = "mypassword"; $db = new PDO ("mysql:host=$hostname;dbname=$dbname","$username","$pw"); } catch (PDOException $e) { echo "Failed to get DB handle: " . $e->getMessage() . "\n"; exit; } echo 'Hello'; $section = 1; $userID = 99; $clean_html = 'test !!!!!!!!!'; $stmt = $db->prepare("INSERT INTO userContent (section, author, content) VALUES (:section, :author, :content)"); $stmt->bindValue(':section', $section, PDO::PARAM_INT); $stmt->bindValue(':author', $userID, PDO::PARAM_INT); $stmt->bindValue(':content', $clean_html, PDO::PARAM_STR); if (!$stmt) { echo "\nPDO::errorInfo():\n"; print_r($dbh->errorInfo()); } echo 'Worked'; ?>
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 = 43) Position 1 = 49, Position 2 = 55
Branch analysis from position: 49
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 55
Found catch point at position: 17
Branch analysis from position: 17
2 jumps found. (Code = 107) Position 1 = 18, Position 2 = -2
Branch analysis from position: 18
1 jumps found. (Code = 79) Position 1 = -2
filename:       /in/7O9jT
function name:  (null)
number of ops:  57
compiled vars:  !0 = $hostname, !1 = $dbname, !2 = $username, !3 = $pw, !4 = $db, !5 = $e, !6 = $section, !7 = $userID, !8 = $clean_html, !9 = $stmt, !10 = $dbh
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   ASSIGN                                                   !0, 'localhost'
    5     1        ASSIGN                                                   !1, 'mydatabase'
    6     2        ASSIGN                                                   !2, 'myusername'
    7     3        ASSIGN                                                   !3, 'mypassword'
    8     4        NEW                                              $15     'PDO'
          5        ROPE_INIT                                     4  ~17     'mysql%3Ahost%3D'
          6        ROPE_ADD                                      1  ~17     ~17, !0
          7        ROPE_ADD                                      2  ~17     ~17, '%3Bdbname%3D'
          8        ROPE_END                                      3  ~16     ~17, !1
          9        SEND_VAL_EX                                              ~16
         10        CAST                                          6  ~19     !2
         11        SEND_VAL_EX                                              ~19
         12        CAST                                          6  ~20     !3
         13        SEND_VAL_EX                                              ~20
         14        DO_FCALL                                      0          
         15        ASSIGN                                                   !4, $15
         16      > JMP                                                      ->24
    9    17  E > > CATCH                                       last         'PDOException'
   10    18    >   INIT_METHOD_CALL                                         !5, 'getMessage'
         19        DO_FCALL                                      0  $23     
         20        CONCAT                                           ~24     'Failed+to+get+DB+handle%3A+', $23
         21        CONCAT                                           ~25     ~24, '%0A'
         22        ECHO                                                     ~25
   11    23      > EXIT                                                     
   13    24    >   ECHO                                                     'Hello'
   15    25        ASSIGN                                                   !6, 1
   16    26        ASSIGN                                                   !7, 99
   17    27        ASSIGN                                                   !8, 'test+%21%21%21%21%21%21%21%21%21'
   19    28        INIT_METHOD_CALL                                         !4, 'prepare'
         29        SEND_VAL_EX                                              'INSERT+INTO+userContent+%28section%2C+author%2C+content%29+VALUES+%28%3Asection%2C+%3Aauthor%2C+%3Acontent%29'
         30        DO_FCALL                                      0  $29     
         31        ASSIGN                                                   !9, $29
   20    32        INIT_METHOD_CALL                                         !9, 'bindValue'
         33        SEND_VAL_EX                                              '%3Asection'
         34        SEND_VAR_EX                                              !6
         35        SEND_VAL_EX                                              1
         36        DO_FCALL                                      0          
   21    37        INIT_METHOD_CALL                                         !9, 'bindValue'
         38        SEND_VAL_EX                                              '%3Aauthor'
         39        SEND_VAR_EX                                              !7
         40        SEND_VAL_EX                                              1
         41        DO_FCALL                                      0          
   22    42        INIT_METHOD_CALL                                         !9, 'bindValue'
         43        SEND_VAL_EX                                              '%3Acontent'
         44        SEND_VAR_EX                                              !8
         45        SEND_VAL_EX                                              2
         46        DO_FCALL                                      0          
   23    47        BOOL_NOT                                         ~34     !9
         48      > JMPZ                                                     ~34, ->55
   24    49    >   ECHO                                                     '%0APDO%3A%3AerrorInfo%28%29%3A%0A'
   25    50        INIT_FCALL                                               'print_r'
         51        INIT_METHOD_CALL                                         !10, 'errorInfo'
         52        DO_FCALL                                      0  $35     
         53        SEND_VAR                                                 $35
         54        DO_ICALL                                                 
   28    55    >   ECHO                                                     'Worked'
   31    56      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.88 ms | 1400 KiB | 15 Q