3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class Productss{ protected $title; protected $category; const CHANGES_SAVED = 'Wijzigingen opgeslagen'; public function __construct($title, $category){ $this->title = $title; $this->category = $category; } public function someFunction(){ self::CHANGES_SAVED; // CHANGES_SAVED not changeable in this class, it is changeable in a child class } public function getCategory(){ return $this->category; } public function getTitle(){ return $this->title; } } class Order extends Productss{ protected $price; protected $deliver; //const CHANGES_SAVED = 'Wijzigingen nu opgeslagen'; public function __construct($title, $category, $price){ parent::__construct($title, $category); $this->title = $title; $this->category = $category; $this->price = $price; $this->doWeDeliver(); } public function getPrice(){ return $this->price; } public function getDeliver(){ return $this->deliver; } protected function doWeDeliver(){ $this->deliver = $this->price > 30 ? 'Yes' : 'No' ; } } $order = new Order('CD Brahms', 'Media', '45'); echo 'Product :'.$order->getTitle(); //echo 'Categorie :'.$order->getCategory(); //echo 'Prijs :'.$order->getPrice(); //echo 'Gratis bezorging :'.$order->getDeliver(); //echo Productss::CHANGES_SAVED.'<br />'; // 300 //echo Order::CHANGES_SAVED.'<br />'; // 500
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = -2
filename:       /in/1l6GX
function name:  (null)
number of ops:  14
compiled vars:  !0 = $order
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   2     0  E >   NOP                                                      
  24     1        NOP                                                      
         2        NOP                                                      
  49     3        NEW                                              $4      :-4
         4        SEND_VAL_EX                                              'CD+Brahms'
         5        SEND_VAL_EX                                              'Media'
         6        SEND_VAL_EX                                              '45'
         7        DO_FCALL                                      0          
         8        ASSIGN                                                   !0, $4
  50     9        INIT_METHOD_CALL                                         !0, 'getTitle'
        10        DO_FCALL                                      0  $7      
        11        CONCAT                                           ~8      'Product+%3A', $7
        12        ECHO                                                     ~8
        13      > RETURN                                                   1

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

End of function __construct

Function somefunction:
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = -2
filename:       /in/1l6GX
function name:  someFunction
number of ops:  1
compiled vars:  none
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  15     0  E > > RETURN                                                   null

End of function somefunction

Function getcategory:
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = -2
filename:       /in/1l6GX
function name:  getCategory
number of ops:  3
compiled vars:  none
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  17     0  E >   FETCH_OBJ_R                                      $0      'category'
         1      > RETURN                                                   $0
  18     2*     > RETURN                                                   null

End of function getcategory

Function gettitle:
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = -2
filename:       /in/1l6GX
function name:  getTitle
number of ops:  3
compiled vars:  none
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  20     0  E >   FETCH_OBJ_R                                      $0      'title'
         1      > RETURN                                                   $0
  21     2*     > RETURN                                                   null

End of function gettitle

End of class Productss.

Class Order:
Function __construct:
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = -2
filename:       /in/1l6GX
function name:  __construct
number of ops:  17
compiled vars:  !0 = $title, !1 = $category, !2 = $price
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  30     0  E >   RECV                                             !0      
         1        RECV                                             !1      
         2        RECV                                             !2      
  31     3        FETCH_CLASS                                 514  :3      
         4        INIT_STATIC_METHOD_CALL                                  $3
         5        SEND_VAR_EX                                              !0
         6        SEND_VAR_EX                                              !1
         7        DO_FCALL                                      0          
  32     8        ASSIGN_OBJ                                               'title'
         9        OP_DATA                                                  !0
  33    10        ASSIGN_OBJ                                               'category'
        11        OP_DATA                                                  !1
  34    12        ASSIGN_OBJ                                               'price'
        13        OP_DATA                                                  !2
  35    14        INIT_METHOD_CALL                                         'doWeDeliver'
        15        DO_FCALL                                      0          
  36    16      > RETURN                                                   null

End of function __construct

Function getprice:
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = -2
filename:       /in/1l6GX
function name:  getPrice
number of ops:  3
compiled vars:  none
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  39     0  E >   FETCH_OBJ_R                                      $0      'price'
         1      > RETURN                                                   $0
  40     2*     > RETURN                                                   null

End of function getprice

Function getdeliver:
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = -2
filename:       /in/1l6GX
function name:  getDeliver
number of ops:  3
compiled vars:  none
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  42     0  E >   FETCH_OBJ_R                                      $0      'deliver'
         1      > RETURN                                                   $0
  43     2*     > RETURN                                                   null

End of function getdeliver

Function dowedeliver:
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = 3, Position 2 = 5
Branch analysis from position: 3
Jump found. Position 1 = 6
Branch analysis from position: 6
Jump found. Position 1 = -2
Branch analysis from position: 5
Jump found. Position 1 = -2
filename:       /in/1l6GX
function name:  doWeDeliver
number of ops:  9
compiled vars:  none
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  45     0  E >   FETCH_OBJ_R                                      $1      'price'
         1        IS_SMALLER                                       ~2      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
  46     8      > RETURN                                                   null

End of function dowedeliver

Function somefunction:
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = -2
filename:       /in/1l6GX
function name:  someFunction
number of ops:  1
compiled vars:  none
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  15     0  E > > RETURN                                                   null

End of function somefunction

Function getcategory:
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = -2
filename:       /in/1l6GX
function name:  getCategory
number of ops:  3
compiled vars:  none
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  17     0  E >   FETCH_OBJ_R                                      $0      'category'
         1      > RETURN                                                   $0
  18     2*     > RETURN                                                   null

End of function getcategory

Function gettitle:
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = -2
filename:       /in/1l6GX
function name:  getTitle
number of ops:  3
compiled vars:  none
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  20     0  E >   FETCH_OBJ_R                                      $0      'title'
         1      > RETURN                                                   $0
  21     2*     > RETURN                                                   null

End of function gettitle

End of class Order.

Generated using Vulcan Logic Dumper, using php 7.2.0