3v4l.org

run code in 300+ PHP versions simultaneously
<?php class IOException extends Exception { protected $path; protected $mode; public function __construct($path, $mode, $message) { parent::__construct($message); $this->path = $path; $this->mode = $mode; } public function getPath() { return $this->path; } } class File { protected $path; protected $handle; protected $mode; public function __construct($path) { $this->path = $path; } public function open($mode) { $this->handle = @fopen($this->path, $mode); if (!$this->handle) { throw new IOException( $this->path, $mode, "could not open the file"); } $this->mode = $mode; } } $file = new File("/no/file"); try { $file->open("r"); } catch (IOException $io) { printf( "Exception occured opening %s\n", $io->getPath()); var_dump($io); } ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 18
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Found catch point at position: 8
Branch analysis from position: 8
2 jumps found. (Code = 107) Position 1 = 9, Position 2 = -2
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/JDHTi
function name:  (null)
number of ops:  19
compiled vars:  !0 = $file, !1 = $io
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   36     0  E >   NEW                                              $2      'File'
          1        SEND_VAL_EX                                              '%2Fno%2Ffile'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $2
   39     4        INIT_METHOD_CALL                                         !0, 'open'
          5        SEND_VAL_EX                                              'r'
          6        DO_FCALL                                      0          
          7      > JMP                                                      ->18
   40     8  E > > CATCH                                       last         'IOException'
   41     9    >   INIT_FCALL                                               'printf'
   42    10        SEND_VAL                                                 'Exception+occured+opening+%25s%0A'
         11        INIT_METHOD_CALL                                         !1, 'getPath'
         12        DO_FCALL                                      0  $6      
         13        SEND_VAR                                                 $6
         14        DO_ICALL                                                 
   43    15        INIT_FCALL                                               'var_dump'
         16        SEND_VAR                                                 !1
         17        DO_ICALL                                                 
   45    18    > > RETURN                                                   1

Class IOException:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/JDHTi
function name:  __construct
number of ops:  11
compiled vars:  !0 = $path, !1 = $mode, !2 = $message
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
    7     3        INIT_STATIC_METHOD_CALL                                  
          4        SEND_VAR_EX                                              !2
          5        DO_FCALL                                      0          
    8     6        ASSIGN_OBJ                                               'path'
          7        OP_DATA                                                  !0
    9     8        ASSIGN_OBJ                                               'mode'
          9        OP_DATA                                                  !1
   10    10      > RETURN                                                   null

End of function __construct

Function getpath:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/JDHTi
function name:  getPath
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   FETCH_OBJ_R                                      ~0      'path'
          1      > RETURN                                                   ~0
   14     2*     > RETURN                                                   null

End of function getpath

End of class IOException.

Class File:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/JDHTi
function name:  __construct
number of ops:  4
compiled vars:  !0 = $path
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   RECV                                             !0      
   23     1        ASSIGN_OBJ                                               'path'
          2        OP_DATA                                                  !0
   24     3      > RETURN                                                   null

End of function __construct

Function open:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 13, Position 2 = 21
Branch analysis from position: 13
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/JDHTi
function name:  open
number of ops:  24
compiled vars:  !0 = $mode
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   26     0  E >   RECV                                             !0      
   27     1        BEGIN_SILENCE                                    ~2      
          2        INIT_FCALL                                               'fopen'
          3        FETCH_OBJ_R                                      ~3      'path'
          4        SEND_VAL                                                 ~3
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                         $4      
          7        END_SILENCE                                              ~2
          8        ASSIGN_OBJ                                               'handle'
          9        OP_DATA                                                  $4
   28    10        FETCH_OBJ_R                                      ~5      'handle'
         11        BOOL_NOT                                         ~6      ~5
         12      > JMPZ                                                     ~6, ->21
   29    13    >   NEW                                              $7      'IOException'
         14        CHECK_FUNC_ARG                                           
   30    15        FETCH_OBJ_FUNC_ARG                               $8      'path'
         16        SEND_FUNC_ARG                                            $8
         17        SEND_VAR_EX                                              !0
         18        SEND_VAL_EX                                              'could+not+open+the+file'
         19        DO_FCALL                                      0          
         20      > THROW                                         0          $7
   32    21    >   ASSIGN_OBJ                                               'mode'
         22        OP_DATA                                                  !0
   33    23      > RETURN                                                   null

End of function open

End of class File.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.63 ms | 1400 KiB | 19 Q