3v4l.org

run code in 300+ PHP versions simultaneously
<?php class IOException extends Exception { protected $file; public function __construct($file, $message) { parent::__construct($message); $this->file = $file; } public function getPath() { return $this->file; } } class File { protected $path; protected $handle; 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, "could not open the file"); } } } $file = new File("/no/file"); try { $file->open("r"); } catch (IOException $io) { printf( "Exception occured opening %s\n", $io->getPath()); $io->printStackTrace(); } ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
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/fke7q
function name:  (null)
number of ops:  18
compiled vars:  !0 = $file, !1 = $io
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   31     0  E >   NEW                                              $2      'File'
          1        SEND_VAL_EX                                              '%2Fno%2Ffile'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $2
   34     4        INIT_METHOD_CALL                                         !0, 'open'
          5        SEND_VAL_EX                                              'r'
          6        DO_FCALL                                      0          
          7      > JMP                                                      ->17
   35     8  E > > CATCH                                       last         'IOException'
   36     9    >   INIT_FCALL                                               'printf'
   37    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                                                 
   38    15        INIT_METHOD_CALL                                         !1, 'printStackTrace'
         16        DO_FCALL                                      0          
   40    17    > > RETURN                                                   1

Class IOException:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fke7q
function name:  __construct
number of ops:  8
compiled vars:  !0 = $file, !1 = $message
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    6     2        INIT_STATIC_METHOD_CALL                                  
          3        SEND_VAR_EX                                              !1
          4        DO_FCALL                                      0          
    7     5        ASSIGN_OBJ                                               'file'
          6        OP_DATA                                                  !0
    8     7      > 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/fke7q
function name:  getPath
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   FETCH_OBJ_R                                      ~0      'file'
          1      > RETURN                                                   ~0
   12     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/fke7q
function name:  __construct
number of ops:  4
compiled vars:  !0 = $path
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   RECV                                             !0      
   20     1        ASSIGN_OBJ                                               'path'
          2        OP_DATA                                                  !0
   21     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 = 20
Branch analysis from position: 13
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 20
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fke7q
function name:  open
number of ops:  21
compiled vars:  !0 = $mode
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   RECV                                             !0      
   24     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
   25    10        FETCH_OBJ_R                                      ~5      'handle'
         11        BOOL_NOT                                         ~6      ~5
         12      > JMPZ                                                     ~6, ->20
   26    13    >   NEW                                              $7      'IOException'
         14        CHECK_FUNC_ARG                                           
         15        FETCH_OBJ_FUNC_ARG                               $8      'path'
         16        SEND_FUNC_ARG                                            $8
         17        SEND_VAL_EX                                              'could+not+open+the+file'
         18        DO_FCALL                                      0          
         19      > THROW                                         0          $7
   28    20    > > RETURN                                                   null

End of function open

End of class File.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
195.59 ms | 1392 KiB | 17 Q