3v4l.org

run code in 300+ PHP versions simultaneously
<?php try { $a = 2 / 0; // connect to database here } catch (PDOException $e) { // exception was a database exception echo 'Database error', $e->getMessage(); } catch (Exception $e) { // exception was a general exception echo 'General error', $e->getMessage(); }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Found catch point at position: 3
Branch analysis from position: 3
2 jumps found. (Code = 107) Position 1 = 4, Position 2 = 9
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
Branch analysis from position: 9
2 jumps found. (Code = 107) Position 1 = 10, Position 2 = -2
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Found catch point at position: 9
Branch analysis from position: 9
filename:       /in/bdE3Q
function name:  (null)
number of ops:  15
compiled vars:  !0 = $a, !1 = $e
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   DIV                                              ~2      2, 0
          1        ASSIGN                                                   !0, ~2
          2      > JMP                                                      ->14
    6     3  E > > CATCH                                                    'PDOException', ->9
    8     4    >   ECHO                                                     'Database+error'
          5        INIT_METHOD_CALL                                         !1, 'getMessage'
          6        DO_FCALL                                      0  $4      
          7        ECHO                                                     $4
          8      > JMP                                                      ->14
    9     9  E > > CATCH                                       last         'Exception'
   11    10    >   ECHO                                                     'General+error'
         11        INIT_METHOD_CALL                                         !1, 'getMessage'
         12        DO_FCALL                                      0  $5      
         13        ECHO                                                     $5
   12    14    > > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.3 ms | 1394 KiB | 13 Q