3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Products{ protected $_title; protected $_category; protected $_price; public function __construct($title, $category, $price){ if($price < 0){ throw new Exception('Price must be a positive number'); } $this->_title = $title; $this->_category = $category; $this->_price = $price; } public function getPrice(){ return $this->_price; } } try{ $product = new Products('Title', 'Category', -45); echo $product->getPrice(); } catch(Exception $e){ echo 'Caught exception: ', $e->getMessage(), "\n"; echo 'Caught exception: ', $e->getCode(), "\n"; echo 'Caught exception: ', $e->getFile(), "\n"; echo 'Caught exception: ', $e->getLine(), "\n"; echo 'Caught exception: ', $e->getTrace(), "\n"; echo 'Caught exception: ', $e->getTraceAsString(), "\n"; echo 'Caught exception: ', $e, "\n"; }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 44
Branch analysis from position: 44
1 jumps found. (Code = 62) Position 1 = -2
Found catch point at position: 10
Branch analysis from position: 10
2 jumps found. (Code = 107) Position 1 = 11, Position 2 = -2
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/uJ6Xn
function name:  (null)
number of ops:  45
compiled vars:  !0 = $product, !1 = $e
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   26     0  E >   NEW                                              $2      'Products'
          1        SEND_VAL_EX                                              'Title'
          2        SEND_VAL_EX                                              'Category'
          3        SEND_VAL_EX                                              -45
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !0, $2
   27     6        INIT_METHOD_CALL                                         !0, 'getPrice'
          7        DO_FCALL                                      0  $5      
          8        ECHO                                                     $5
          9      > JMP                                                      ->44
   29    10  E > > CATCH                                       last         'Exception'
   30    11    >   ECHO                                                     'Caught+exception%3A+'
         12        INIT_METHOD_CALL                                         !1, 'getMessage'
         13        DO_FCALL                                      0  $6      
         14        ECHO                                                     $6
         15        ECHO                                                     '%0A'
   31    16        ECHO                                                     'Caught+exception%3A+'
         17        INIT_METHOD_CALL                                         !1, 'getCode'
         18        DO_FCALL                                      0  $7      
         19        ECHO                                                     $7
         20        ECHO                                                     '%0A'
   32    21        ECHO                                                     'Caught+exception%3A+'
         22        INIT_METHOD_CALL                                         !1, 'getFile'
         23        DO_FCALL                                      0  $8      
         24        ECHO                                                     $8
         25        ECHO                                                     '%0A'
   33    26        ECHO                                                     'Caught+exception%3A+'
         27        INIT_METHOD_CALL                                         !1, 'getLine'
         28        DO_FCALL                                      0  $9      
         29        ECHO                                                     $9
         30        ECHO                                                     '%0A'
   34    31        ECHO                                                     'Caught+exception%3A+'
         32        INIT_METHOD_CALL                                         !1, 'getTrace'
         33        DO_FCALL                                      0  $10     
         34        ECHO                                                     $10
         35        ECHO                                                     '%0A'
   35    36        ECHO                                                     'Caught+exception%3A+'
         37        INIT_METHOD_CALL                                         !1, 'getTraceAsString'
         38        DO_FCALL                                      0  $11     
         39        ECHO                                                     $11
         40        ECHO                                                     '%0A'
   36    41        ECHO                                                     'Caught+exception%3A+'
         42        ECHO                                                     !1
         43        ECHO                                                     '%0A'
   37    44    > > RETURN                                                   1

Class Products:
Function __construct:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 9
Branch analysis from position: 5
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/uJ6Xn
function name:  __construct
number of ops:  16
compiled vars:  !0 = $title, !1 = $category, !2 = $price
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
   10     3        IS_SMALLER                                               !2, 0
          4      > JMPZ                                                     ~3, ->9
   11     5    >   NEW                                              $4      'Exception'
          6        SEND_VAL_EX                                              'Price+must+be+a+positive+number'
          7        DO_FCALL                                      0          
          8      > THROW                                         0          $4
   13     9    >   ASSIGN_OBJ                                               '_title'
         10        OP_DATA                                                  !0
   14    11        ASSIGN_OBJ                                               '_category'
         12        OP_DATA                                                  !1
   15    13        ASSIGN_OBJ                                               '_price'
         14        OP_DATA                                                  !2
   16    15      > RETURN                                                   null

End of function __construct

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

End of function getprice

End of class Products.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
145.96 ms | 1399 KiB | 13 Q