3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Manufacturer{ protected $_name; public function setManufacturerName($name){ $this->_name = $name; } public function getManufacturerName(){ return $this->_name; } } class Productt{ protected $_title; protected $_category; protected $_manufacturer; public function __construct(){ $this->_manufacturer = new Manufacturer(); } public function getCategory(){ return $this->_category; } public function getTitle(){ return $this->_title; } public function __clone(){ $this->_manufacturer = clone $this->_manufacturer; } public function setManufacturerName($name){ $this->_manufacturer->setManufacturerName($name); } public function getManufacturerName(){ return $this->_manufacturer->getManufacturerName(); } } class Order extends Productt{ protected $_price; protected $_deliver; public function __construct($title, $category, $price){ parent::__construct(); $this->_title = $title; $this->_category = $category; $this->_price = $price; $this->doWeDeliver(); } public function setTitle($title){ $this->_title = $title; } public function getPrice(){ return $this->_price; } public function getDeliver(){ return $this->_deliver; } protected function doWeDeliver(){ $this->_deliver = $this->_price > 30 ? "Yes" : "No" ; } public function displaySentence(){ echo "Product: ".$this->_title." Category: ".$this->_category." Prijs: ".$this->_price." Gratis bezorging: ".$this->_deliver; } } $order = new Order("CD Brahms", "Media", "45"); $order->setManufacturerName("Producent A"); echo $order->getTitle()." is made by ". $order->getManufacturerName()."<br />"; // CD Brahms is made by Producent A $order2 = clone $order; $order2->setTitle("Second title"); $order2->setManufacturerName("Producent X"); echo $order2->getTitle()." is made by ". $order2->getManufacturerName()."<br />"; // Second title is made by Producent B echo $order->getTitle()." is made by ". $order->getManufacturerName()."<br />"; // CD Brahms is made by Producent A
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ZGDdu
function name:  (null)
number of ops:  42
compiled vars:  !0 = $order, !1 = $order2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   81     0  E >   NEW                                              $2      'Order'
          1        SEND_VAL_EX                                              'CD+Brahms'
          2        SEND_VAL_EX                                              'Media'
          3        SEND_VAL_EX                                              '45'
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !0, $2
   82     6        INIT_METHOD_CALL                                         !0, 'setManufacturerName'
          7        SEND_VAL_EX                                              'Producent+A'
          8        DO_FCALL                                      0          
   83     9        INIT_METHOD_CALL                                         !0, 'getTitle'
         10        DO_FCALL                                      0  $6      
         11        CONCAT                                           ~7      $6, '+is+made+by+'
         12        INIT_METHOD_CALL                                         !0, 'getManufacturerName'
         13        DO_FCALL                                      0  $8      
         14        CONCAT                                           ~9      ~7, $8
         15        CONCAT                                           ~10     ~9, '%3Cbr+%2F%3E'
         16        ECHO                                                     ~10
   84    17        CLONE                                            ~11     !0
         18        ASSIGN                                                   !1, ~11
   85    19        INIT_METHOD_CALL                                         !1, 'setTitle'
         20        SEND_VAL_EX                                              'Second+title'
         21        DO_FCALL                                      0          
   86    22        INIT_METHOD_CALL                                         !1, 'setManufacturerName'
         23        SEND_VAL_EX                                              'Producent+X'
         24        DO_FCALL                                      0          
   87    25        INIT_METHOD_CALL                                         !1, 'getTitle'
         26        DO_FCALL                                      0  $15     
         27        CONCAT                                           ~16     $15, '+is+made+by+'
         28        INIT_METHOD_CALL                                         !1, 'getManufacturerName'
         29        DO_FCALL                                      0  $17     
         30        CONCAT                                           ~18     ~16, $17
         31        CONCAT                                           ~19     ~18, '%3Cbr+%2F%3E'
         32        ECHO                                                     ~19
   88    33        INIT_METHOD_CALL                                         !0, 'getTitle'
         34        DO_FCALL                                      0  $20     
         35        CONCAT                                           ~21     $20, '+is+made+by+'
         36        INIT_METHOD_CALL                                         !0, 'getManufacturerName'
         37        DO_FCALL                                      0  $22     
         38        CONCAT                                           ~23     ~21, $22
         39        CONCAT                                           ~24     ~23, '%3Cbr+%2F%3E'
         40        ECHO                                                     ~24
         41      > RETURN                                                   1

Class Manufacturer:
Function setmanufacturername:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ZGDdu
function name:  setManufacturerName
number of ops:  4
compiled vars:  !0 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
    7     1        ASSIGN_OBJ                                               '_name'
          2        OP_DATA                                                  !0
    8     3      > RETURN                                                   null

End of function setmanufacturername

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

End of function getmanufacturername

End of class Manufacturer.

Class Productt:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ZGDdu
function name:  __construct
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   NEW                                              $1      'Manufacturer'
          1        DO_FCALL                                      0          
          2        ASSIGN_OBJ                                               '_manufacturer'
          3        OP_DATA                                                  $1
   23     4      > 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/ZGDdu
function name:  getCategory
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   26     0  E >   FETCH_OBJ_R                                      ~0      '_category'
          1      > RETURN                                                   ~0
   27     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/ZGDdu
function name:  getTitle
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   29     0  E >   FETCH_OBJ_R                                      ~0      '_title'
          1      > RETURN                                                   ~0
   30     2*     > RETURN                                                   null

End of function gettitle

Function __clone:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ZGDdu
function name:  __clone
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   35     0  E >   FETCH_OBJ_R                                      ~1      '_manufacturer'
          1        CLONE                                            ~2      ~1
          2        ASSIGN_OBJ                                               '_manufacturer'
          3        OP_DATA                                                  ~2
   36     4      > RETURN                                                   null

End of function __clone

Function setmanufacturername:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ZGDdu
function name:  setManufacturerName
number of ops:  6
compiled vars:  !0 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   41     0  E >   RECV                                             !0      
   42     1        FETCH_OBJ_R                                      ~1      '_manufacturer'
          2        INIT_METHOD_CALL                                         ~1, 'setManufacturerName'
          3        SEND_VAR_EX                                              !0
          4        DO_FCALL                                      0          
   43     5      > RETURN                                                   null

End of function setmanufacturername

Function getmanufacturername:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ZGDdu
function name:  getManufacturerName
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   46     0  E >   FETCH_OBJ_R                                      ~0      '_manufacturer'
          1        INIT_METHOD_CALL                                         ~0, 'getManufacturerName'
          2        DO_FCALL                                      0  $1      
          3      > RETURN                                                   $1
   47     4*     > RETURN                                                   null

End of function getmanufacturername

End of class Productt.

Class Order:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ZGDdu
function name:  __construct
number of ops:  14
compiled vars:  !0 = $title, !1 = $category, !2 = $price
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   55     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
   56     3        INIT_STATIC_METHOD_CALL                                  
          4        DO_FCALL                                      0          
   57     5        ASSIGN_OBJ                                               '_title'
          6        OP_DATA                                                  !0
   58     7        ASSIGN_OBJ                                               '_category'
          8        OP_DATA                                                  !1
   59     9        ASSIGN_OBJ                                               '_price'
         10        OP_DATA                                                  !2
   60    11        INIT_METHOD_CALL                                         'doWeDeliver'
         12        DO_FCALL                                      0          
   61    13      > RETURN                                                   null

End of function __construct

Function settitle:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ZGDdu
function name:  setTitle
number of ops:  4
compiled vars:  !0 = $title
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   63     0  E >   RECV                                             !0      
   64     1        ASSIGN_OBJ                                               '_title'
          2        OP_DATA                                                  !0
   65     3      > RETURN                                                   null

End of function settitle

Function getprice:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ZGDdu
function name:  getPrice
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   68     0  E >   FETCH_OBJ_R                                      ~0      '_price'
          1      > RETURN                                                   ~0
   69     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/ZGDdu
function name:  getDeliver
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   71     0  E >   FETCH_OBJ_R                                      ~0      '_deliver'
          1      > RETURN                                                   ~0
   72     2*     > RETURN                                                   null

End of function getdeliver

Function dowedeliver:
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/ZGDdu
function name:  doWeDeliver
number of ops:  9
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   74     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
   75     8      > RETURN                                                   null

End of function dowedeliver

Function displaysentence:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ZGDdu
function name:  displaySentence
number of ops:  13
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   77     0  E >   FETCH_OBJ_R                                      ~0      '_title'
          1        CONCAT                                           ~1      'Product%3A+', ~0
          2        CONCAT                                           ~2      ~1, '+Category%3A+'
          3        FETCH_OBJ_R                                      ~3      '_category'
          4        CONCAT                                           ~4      ~2, ~3
          5        CONCAT                                           ~5      ~4, '+Prijs%3A+'
          6        FETCH_OBJ_R                                      ~6      '_price'
          7        CONCAT                                           ~7      ~5, ~6
          8        CONCAT                                           ~8      ~7, '+Gratis+bezorging%3A+'
          9        FETCH_OBJ_R                                      ~9      '_deliver'
         10        CONCAT                                           ~10     ~8, ~9
         11        ECHO                                                     ~10
   78    12      > RETURN                                                   null

End of function displaysentence

Function getcategory:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ZGDdu
function name:  getCategory
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   26     0  E >   FETCH_OBJ_R                                      ~0      '_category'
          1      > RETURN                                                   ~0
   27     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/ZGDdu
function name:  getTitle
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   29     0  E >   FETCH_OBJ_R                                      ~0      '_title'
          1      > RETURN                                                   ~0
   30     2*     > RETURN                                                   null

End of function gettitle

Function __clone:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ZGDdu
function name:  __clone
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   35     0  E >   FETCH_OBJ_R                                      ~1      '_manufacturer'
          1        CLONE                                            ~2      ~1
          2        ASSIGN_OBJ                                               '_manufacturer'
          3        OP_DATA                                                  ~2
   36     4      > RETURN                                                   null

End of function __clone

Function setmanufacturername:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ZGDdu
function name:  setManufacturerName
number of ops:  6
compiled vars:  !0 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   41     0  E >   RECV                                             !0      
   42     1        FETCH_OBJ_R                                      ~1      '_manufacturer'
          2        INIT_METHOD_CALL                                         ~1, 'setManufacturerName'
          3        SEND_VAR_EX                                              !0
          4        DO_FCALL                                      0          
   43     5      > RETURN                                                   null

End of function setmanufacturername

Function getmanufacturername:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ZGDdu
function name:  getManufacturerName
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   46     0  E >   FETCH_OBJ_R                                      ~0      '_manufacturer'
          1        INIT_METHOD_CALL                                         ~0, 'getManufacturerName'
          2        DO_FCALL                                      0  $1      
          3      > RETURN                                                   $1
   47     4*     > RETURN                                                   null

End of function getmanufacturername

End of class Order.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.53 ms | 1415 KiB | 13 Q