3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Products{ // Properties protected $_title; protected $_category; protected $_p = 'kak'; // Methods public function __construct($title, $category){ $this->_title = $title; $this->_category = $category; } public function getCategory(){ return $this->_category; } public function getTitle(){ return $this->_title; } } class Order extends Products{ // Properties // Methods public function __construct($title, $category){ parent::__construct($title, $category); $this->freeDomesticShipment(); // method called } public function getPrice(){ return $this->_price; } public function getDeliver(){ return $this->_deliver; } protected function freeDomesticShipment(){ $this->_deliver = $this->_price > 30 ? 'Yes' : 'No' ; } } class Add extends Order{ // Properties protected $_price; protected $_deliver; // Methods public function __construct($title, $category, $price){ parent::__construct($title, $category); $this->_price = $price; $this->freeDomesticShipment(); // method called } public function getPrice(){ return $this->_price; } public function getP(){ return $this->_p; } public function getDeliver(){ return $this->_deliver; } protected function freeDomesticShipment(){ $this->_deliver = $this->_price > 30 ? 'Yes' : 'No' ; } } $order = new Add('CD Brahms', 'Media', '45'); echo 'Product: '.$order->getTitle(); echo 'Categorie: '.$order->getCategory(); echo 'Prijs: '.$order->getPrice(); echo 'Gratis bezorging: '.$order->getDeliver();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/XKA8M
function name:  (null)
number of ops:  23
compiled vars:  !0 = $order
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   65     0  E >   NEW                                              $1      'Add'
          1        SEND_VAL_EX                                              'CD+Brahms'
          2        SEND_VAL_EX                                              'Media'
          3        SEND_VAL_EX                                              '45'
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !0, $1
   66     6        INIT_METHOD_CALL                                         !0, 'getTitle'
          7        DO_FCALL                                      0  $4      
          8        CONCAT                                           ~5      'Product%3A+', $4
          9        ECHO                                                     ~5
   67    10        INIT_METHOD_CALL                                         !0, 'getCategory'
         11        DO_FCALL                                      0  $6      
         12        CONCAT                                           ~7      'Categorie%3A+', $6
         13        ECHO                                                     ~7
   68    14        INIT_METHOD_CALL                                         !0, 'getPrice'
         15        DO_FCALL                                      0  $8      
         16        CONCAT                                           ~9      'Prijs%3A+', $8
         17        ECHO                                                     ~9
   69    18        INIT_METHOD_CALL                                         !0, 'getDeliver'
         19        DO_FCALL                                      0  $10     
         20        CONCAT                                           ~11     'Gratis+bezorging%3A+', $10
         21        ECHO                                                     ~11
         22      > RETURN                                                   1

Class Products:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/XKA8M
function name:  __construct
number of ops:  7
compiled vars:  !0 = $title, !1 = $category
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   10     2        ASSIGN_OBJ                                               '_title'
          3        OP_DATA                                                  !0
   11     4        ASSIGN_OBJ                                               '_category'
          5        OP_DATA                                                  !1
   12     6      > RETURN                                                   null

End of function __construct

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

End of function getcategory

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

End of function gettitle

End of class Products.

Class Order:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/XKA8M
function name:  __construct
number of ops:  9
compiled vars:  !0 = $title, !1 = $category
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   25     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   26     2        INIT_STATIC_METHOD_CALL                                  
          3        SEND_VAR_EX                                              !0
          4        SEND_VAR_EX                                              !1
          5        DO_FCALL                                      0          
   28     6        INIT_METHOD_CALL                                         'freeDomesticShipment'
          7        DO_FCALL                                      0          
   29     8      > 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/XKA8M
function name:  getPrice
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   31     0  E >   FETCH_OBJ_R                                      ~0      '_price'
          1      > RETURN                                                   ~0
   32     2*     > RETURN                                                   null

End of function getprice

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

End of function getdeliver

Function freedomesticshipment:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 5
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/XKA8M
function name:  freeDomesticShipment
number of ops:  9
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   37     0  E >   FETCH_OBJ_R                                      ~1      '_price'
          1        IS_SMALLER                                               30, ~1
          2      > JMPZ                                                     ~2, ->5
          3    >   QM_ASSIGN                                        ~3      'Yes'
          4      > JMP                                                      ->6
          5    >   QM_ASSIGN                                        ~3      'No'
          6    >   ASSIGN_OBJ                                               '_deliver'
          7        OP_DATA                                                  ~3
   38     8      > RETURN                                                   null

End of function freedomesticshipment

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

End of function getcategory

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

End of function gettitle

End of class Order.

Class Add:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/XKA8M
function name:  __construct
number of ops:  12
compiled vars:  !0 = $title, !1 = $category, !2 = $price
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   46     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
   47     3        INIT_STATIC_METHOD_CALL                                  
          4        SEND_VAR_EX                                              !0
          5        SEND_VAR_EX                                              !1
          6        DO_FCALL                                      0          
   48     7        ASSIGN_OBJ                                               '_price'
          8        OP_DATA                                                  !2
   49     9        INIT_METHOD_CALL                                         'freeDomesticShipment'
         10        DO_FCALL                                      0          
   50    11      > 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/XKA8M
function name:  getPrice
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   52     0  E >   FETCH_OBJ_R                                      ~0      '_price'
          1      > RETURN                                                   ~0
   53     2*     > RETURN                                                   null

End of function getprice

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

End of function getp

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

End of function getdeliver

Function freedomesticshipment:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 5
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/XKA8M
function name:  freeDomesticShipment
number of ops:  9
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   61     0  E >   FETCH_OBJ_R                                      ~1      '_price'
          1        IS_SMALLER                                               30, ~1
          2      > JMPZ                                                     ~2, ->5
          3    >   QM_ASSIGN                                        ~3      'Yes'
          4      > JMP                                                      ->6
          5    >   QM_ASSIGN                                        ~3      'No'
          6    >   ASSIGN_OBJ                                               '_deliver'
          7        OP_DATA                                                  ~3
   62     8      > RETURN                                                   null

End of function freedomesticshipment

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

End of function getcategory

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

End of function gettitle

End of class Add.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.94 ms | 1407 KiB | 13 Q