3v4l.org

run code in 300+ PHP versions simultaneously
<?php ini_set('display_startup_errors',1); ini_set('display_errors',1); error_reporting(-1); /** * Created in PhpStorm. * User: 750430 * Date: 04/03/2016 * Time: 20:52 */ include __DIR__.'/db_settings.php'; // try/catch to connect to the db and create the database using a prepared statement if it doesn't exist. try{ $pdo = new PDO("mysql:host' . HOST.'; charset='.CHARSET.';port='.POST.'", $user, $pass); $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $stmt = $pdo->prepare("CREATE DATABASE IF NOT EXISTS $db"); $stmt->execute(); $results["meta"]["feedback"] = "Database created."; return $results; } catch (PDOException $e) { echo 'Create DB failed: ' . $e->getMessage(); } try{ $stmt = $pdo->prepare("USE $db"); $stmt->execute(); $error = 'use db'; throw new Exception($error); } catch (PDOException $e) { echo 'DB use failed: ' . $e->getMessage(); } try{ $stmt = $pdo->query(DATABASE_INIT); $stmt->execute(); $error = 'create tables'; throw new Exception($error); } catch (PDOException $e) { echo 'Create tables failed: ' . $e->getMessage(); } echo ini_get('display_errors');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
Found catch point at position: 35
Branch analysis from position: 35
2 jumps found. (Code = 107) Position 1 = 36, Position 2 = -2
Branch analysis from position: 36
1 jumps found. (Code = 108) Position 1 = -2
Found catch point at position: 54
Branch analysis from position: 54
2 jumps found. (Code = 107) Position 1 = 55, Position 2 = -2
Branch analysis from position: 55
1 jumps found. (Code = 108) Position 1 = -2
Found catch point at position: 72
Branch analysis from position: 72
2 jumps found. (Code = 107) Position 1 = 73, Position 2 = -2
Branch analysis from position: 73
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/s24fs
function name:  (null)
number of ops:  82
compiled vars:  !0 = $pdo, !1 = $user, !2 = $pass, !3 = $stmt, !4 = $db, !5 = $results, !6 = $e, !7 = $error
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   INIT_FCALL                                               'ini_set'
          1        SEND_VAL                                                 'display_startup_errors'
          2        SEND_VAL                                                 1
          3        DO_ICALL                                                 
    3     4        INIT_FCALL                                               'ini_set'
          5        SEND_VAL                                                 'display_errors'
          6        SEND_VAL                                                 1
          7        DO_ICALL                                                 
    4     8        INIT_FCALL                                               'error_reporting'
          9        SEND_VAL                                                 -1
         10        DO_ICALL                                                 
   11    11        INCLUDE_OR_EVAL                                          '%2Fin%2Fdb_settings.php', INCLUDE
   15    12        NEW                                              $12     'PDO'
         13        SEND_VAL_EX                                              'mysql%3Ahost%27+.+HOST.%27%3B+charset%3D%27.CHARSET.%27%3Bport%3D%27.POST.%27'
         14        SEND_VAR_EX                                              !1
         15        SEND_VAR_EX                                              !2
         16        DO_FCALL                                      0          
         17        ASSIGN                                                   !0, $12
   16    18        INIT_METHOD_CALL                                         !0, 'setAttribute'
         19        SEND_VAL_EX                                              3
         20        SEND_VAL_EX                                              2
         21        DO_FCALL                                      0          
   17    22        INIT_METHOD_CALL                                         !0, 'prepare'
         23        NOP                                                      
         24        FAST_CONCAT                                      ~16     'CREATE+DATABASE+IF+NOT+EXISTS+', !4
         25        SEND_VAL_EX                                              ~16
         26        DO_FCALL                                      0  $17     
         27        ASSIGN                                                   !3, $17
   18    28        INIT_METHOD_CALL                                         !3, 'execute'
         29        DO_FCALL                                      0          
   19    30        FETCH_DIM_W                                      $20     !5, 'meta'
         31        ASSIGN_DIM                                               $20, 'feedback'
         32        OP_DATA                                                  'Database+created.'
   20    33      > RETURN                                                   !5
         34*       JMP                                                      ->40
   21    35  E > > CATCH                                       last         'PDOException'
   22    36    >   INIT_METHOD_CALL                                         !6, 'getMessage'
         37        DO_FCALL                                      0  $22     
         38        CONCAT                                           ~23     'Create+DB+failed%3A+', $22
         39        ECHO                                                     ~23
   25    40        INIT_METHOD_CALL                                         !0, 'prepare'
         41        NOP                                                      
         42        FAST_CONCAT                                      ~24     'USE+', !4
         43        SEND_VAL_EX                                              ~24
         44        DO_FCALL                                      0  $25     
         45        ASSIGN                                                   !3, $25
   26    46        INIT_METHOD_CALL                                         !3, 'execute'
         47        DO_FCALL                                      0          
   27    48        ASSIGN                                                   !7, 'use+db'
   28    49        NEW                                              $29     'Exception'
         50        SEND_VAR_EX                                              !7
         51        DO_FCALL                                      0          
         52      > THROW                                         0          $29
         53*       JMP                                                      ->59
   29    54  E > > CATCH                                       last         'PDOException'
   30    55    >   INIT_METHOD_CALL                                         !6, 'getMessage'
         56        DO_FCALL                                      0  $31     
         57        CONCAT                                           ~32     'DB+use+failed%3A+', $31
         58        ECHO                                                     ~32
   33    59        INIT_METHOD_CALL                                         !0, 'query'
         60        FETCH_CONSTANT                                   ~33     'DATABASE_INIT'
         61        SEND_VAL_EX                                              ~33
         62        DO_FCALL                                      0  $34     
         63        ASSIGN                                                   !3, $34
   34    64        INIT_METHOD_CALL                                         !3, 'execute'
         65        DO_FCALL                                      0          
   35    66        ASSIGN                                                   !7, 'create+tables'
   36    67        NEW                                              $38     'Exception'
         68        SEND_VAR_EX                                              !7
         69        DO_FCALL                                      0          
         70      > THROW                                         0          $38
         71*       JMP                                                      ->77
   37    72  E > > CATCH                                       last         'PDOException'
   38    73    >   INIT_METHOD_CALL                                         !6, 'getMessage'
         74        DO_FCALL                                      0  $40     
         75        CONCAT                                           ~41     'Create+tables+failed%3A+', $40
         76        ECHO                                                     ~41
   41    77        INIT_FCALL                                               'ini_get'
         78        SEND_VAL                                                 'display_errors'
         79        DO_ICALL                                         $42     
         80        ECHO                                                     $42
         81      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
189.08 ms | 1400 KiB | 19 Q