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 getTitle(){ return $this->_title; } public function getCategory(){ return $this->_category; } public function getPrice(){ return $this->_price; } } $product = new Products('Title', 'Category', -45); echo $product->getPrice();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Ql7Fe
function name:  (null)
number of ops:  10
compiled vars:  !0 = $product
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   29     0  E >   NEW                                              $1      'Products'
          1        SEND_VAL_EX                                              'Title'
          2        SEND_VAL_EX                                              'Category'
          3        SEND_VAL_EX                                              -45
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !0, $1
   30     6        INIT_METHOD_CALL                                         !0, 'getPrice'
          7        DO_FCALL                                      0  $4      
          8        ECHO                                                     $4
          9      > 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/Ql7Fe
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 gettitle:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Ql7Fe
function name:  getTitle
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   FETCH_OBJ_R                                      ~0      '_title'
          1      > RETURN                                                   ~0
   20     2*     > RETURN                                                   null

End of function gettitle

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

End of function getcategory

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

End of function getprice

End of class Products.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
165.2 ms | 1399 KiB | 13 Q