3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Product { /* Static Methos and Properties example */ public static $manufacturer = "Bart Taylor"; public $name = 'default_name'; public $price = 0; public $desc = 'default description'; function __construct($name, $price, $desc){ $this->name = $name; $this->price = $price; $this->desc = $desc; } public function getInfo(){ return "Product Name: ". $this->name; } public function getMaker(){ return self::$manufacturer; } } /* Part on Object Inheritance */ //SUB-CLASS class Soda extends Product { public $flavor; function __construct($name, $price, $desc, $flavor){ parent::__construct($name, $price, $desc); $this->favor = $flavor; } public function getInfo(){ return "Product Name: ". $this->name . "Flavor: ". $this->flavor; } } $shirt = new Product("Space Juice T-Shirt", 20, "Awesome Grey T-Shirt");
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Ga4JW
function name:  (null)
number of ops:  7
compiled vars:  !0 = $shirt
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   45     0  E >   NEW                                              $1      'Product'
          1        SEND_VAL_EX                                              'Space+Juice+T-Shirt'
          2        SEND_VAL_EX                                              20
          3        SEND_VAL_EX                                              'Awesome+Grey+T-Shirt'
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !0, $1
          6      > RETURN                                                   1

Class Product:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Ga4JW
function name:  __construct
number of ops:  10
compiled vars:  !0 = $name, !1 = $price, !2 = $desc
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
   15     3        ASSIGN_OBJ                                               'name'
          4        OP_DATA                                                  !0
   16     5        ASSIGN_OBJ                                               'price'
          6        OP_DATA                                                  !1
   17     7        ASSIGN_OBJ                                               'desc'
          8        OP_DATA                                                  !2
   18     9      > RETURN                                                   null

End of function __construct

Function getinfo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Ga4JW
function name:  getInfo
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   FETCH_OBJ_R                                      ~0      'name'
          1        CONCAT                                           ~1      'Product+Name%3A+', ~0
          2      > RETURN                                                   ~1
   22     3*     > RETURN                                                   null

End of function getinfo

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

End of function getmaker

End of class Product.

Class Soda:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Ga4JW
function name:  __construct
number of ops:  12
compiled vars:  !0 = $name, !1 = $price, !2 = $desc, !3 = $flavor
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   35     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
          3        RECV                                             !3      
   36     4        INIT_STATIC_METHOD_CALL                                  
          5        SEND_VAR_EX                                              !0
          6        SEND_VAR_EX                                              !1
          7        SEND_VAR_EX                                              !2
          8        DO_FCALL                                      0          
   37     9        ASSIGN_OBJ                                               'favor'
         10        OP_DATA                                                  !3
   38    11      > RETURN                                                   null

End of function __construct

Function getinfo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Ga4JW
function name:  getInfo
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   41     0  E >   FETCH_OBJ_R                                      ~0      'name'
          1        CONCAT                                           ~1      'Product+Name%3A+', ~0
          2        CONCAT                                           ~2      ~1, 'Flavor%3A+'
          3        FETCH_OBJ_R                                      ~3      'flavor'
          4        CONCAT                                           ~4      ~2, ~3
          5      > RETURN                                                   ~4
   42     6*     > RETURN                                                   null

End of function getinfo

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

End of function getmaker

End of class Soda.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
179.29 ms | 1403 KiB | 13 Q