3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Product { private string $title; private string $description; private int $price; private string $currency; private string $category; private string $brand; private array $options; /** * @param string $title * @param string $description * @param int $price * @param string $currency * @param string $category * @param string $brand * @param array $options */ public function __construct(string $title, string $description, int $price, string $currency, string $category, string $brand, array $options) { $this->title = $title; $this->description = $description; $this->price = $price; $this->currency = $currency; $this->category = $category; $this->brand = $brand; $this->options = $options; } /** * @return string */ public function getTitle(): string { return $this->title; } /** * @param string $title */ public function setTitle(string $title): void { $this->title = $title; } /** * @return string */ public function getDescription(): string { return $this->description; } /** * @param string $description */ public function setDescription(string $description): void { $this->description = $description; } /** * @return int */ public function getPrice(): int { return $this->price; } /** * @param int $price */ public function setPrice(int $price): void { $this->price = $price; } /** * @return string */ public function getCurrency(): string { return $this->currency; } /** * @param string $currency */ public function setCurrency(string $currency): void { $this->currency = $currency; } /** * @return string */ public function getCategory(): string { return $this->category; } /** * @param string $category */ public function setCategory(string $category): void { $this->category = $category; } /** * @return string */ public function getBrand(): string { return $this->brand; } /** * @param string $brand */ public function setBrand(string $brand): void { $this->brand = $brand; } /** * @return array */ public function getOptions(): array { return $this->options; } /** * @param array $options */ public function setOptions(array $options): void { $this->options = $options; } } class Option { private string $title; private string $description; private int $price; private array $items; /** * @param string $title * @param string $description * @param int $price * @param array $items */ public function __construct(string $title, string $description, int $price, array $items) { $this->title = $title; $this->description = $description; $this->price = $price; $this->items = $items; } /** * @param string $title */ public function setTitle(string $title): void { $this->title = $title; } /** * @param string $description */ public function setDescription(string $description): void { $this->description = $description; } /** * @param int $price */ public function setPrice(int $price): void { $this->price = $price; } /** * @param array $items */ public function setItems(array $items): void { $this->items = $items; } } class OptionItem { private string $title; private string $description; private int $price; /** * @param string $title * @param string $description * @param int $price */ public function __construct(string $title, string $description, int $price) { $this->title = $title; $this->description = $description; $this->price = $price; } /** * @param string $title */ public function setTitle(string $title): void { $this->title = $title; } /** * @param string $description */ public function setDescription(string $description): void { $this->description = $description; } /** * @param int $price */ public function setPrice(int $price): void { $this->price = $price; } } $product = []; for ($k = 0; $k <= 100; $k++) { $options = []; for ($j = 0; $j <= 10; $j++) { $optionItems = []; for ($i = 0; $i <= 100; $i++) { $optionItem = new OptionItem(title: 'OptionItem' . $i, description: 'OptionItem ' . $i . ' Description', price: random_int(1000, 10000)); $optionItems[] = $optionItem; } $option = new Option(title: 'Option' . $j, description: 'Option ' . $j . ' Description', price: random_int(1000, 10000), items: $optionItems); $options[] = $option; } $product[] = new Product(title: 'Product' . $k, description: 'Product ' . $k . ' Description', price: random_int(1000, 10000), currency: 'USD', category: 'Category' . $k, brand: 'Brand' . $k, options: $options); }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 70
Branch analysis from position: 70
2 jumps found. (Code = 44) Position 1 = 72, Position 2 = 3
Branch analysis from position: 72
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 46
Branch analysis from position: 46
2 jumps found. (Code = 44) Position 1 = 48, Position 2 = 6
Branch analysis from position: 48
2 jumps found. (Code = 44) Position 1 = 72, Position 2 = 3
Branch analysis from position: 72
Branch analysis from position: 3
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 26
Branch analysis from position: 26
2 jumps found. (Code = 44) Position 1 = 28, Position 2 = 9
Branch analysis from position: 28
2 jumps found. (Code = 44) Position 1 = 48, Position 2 = 6
Branch analysis from position: 48
Branch analysis from position: 6
Branch analysis from position: 9
2 jumps found. (Code = 44) Position 1 = 28, Position 2 = 9
Branch analysis from position: 28
Branch analysis from position: 9
filename:       /in/CU0MC
function name:  (null)
number of ops:  73
compiled vars:  !0 = $product, !1 = $k, !2 = $options, !3 = $j, !4 = $optionItems, !5 = $i, !6 = $optionItem, !7 = $option
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  244     0  E >   ASSIGN                                                   !0, <array>
  245     1        ASSIGN                                                   !1, 0
          2      > JMP                                                      ->70
  246     3    >   ASSIGN                                                   !2, <array>
  247     4        ASSIGN                                                   !3, 0
          5      > JMP                                                      ->46
  248     6    >   ASSIGN                                                   !4, <array>
  249     7        ASSIGN                                                   !5, 0
          8      > JMP                                                      ->26
  250     9    >   NEW                                              $14     'OptionItem'
         10        CONCAT                                           ~15     'OptionItem', !5
         11        SEND_VAL_EX                                              ~15, 'title'
         12        CONCAT                                           ~16     'OptionItem+', !5
         13        CONCAT                                           ~17     ~16, '+Description'
         14        SEND_VAL_EX                                              ~17, 'description'
         15        INIT_FCALL                                               'random_int'
         16        SEND_VAL                                                 1000
         17        SEND_VAL                                                 10000
         18        DO_ICALL                                         $18     
         19        SEND_VAR_NO_REF_EX                                       $18, 'price'
         20        CHECK_UNDEF_ARGS                                         
         21        DO_FCALL                                      1          
         22        ASSIGN                                                   !6, $14
  251    23        ASSIGN_DIM                                               !4
         24        OP_DATA                                                  !6
  249    25        PRE_INC                                                  !5
         26    >   IS_SMALLER_OR_EQUAL                                      !5, 100
         27      > JMPNZ                                                    ~23, ->9
  254    28    >   NEW                                              $24     'Option'
         29        CONCAT                                           ~25     'Option', !3
         30        SEND_VAL_EX                                              ~25, 'title'
         31        CONCAT                                           ~26     'Option+', !3
         32        CONCAT                                           ~27     ~26, '+Description'
         33        SEND_VAL_EX                                              ~27, 'description'
         34        INIT_FCALL                                               'random_int'
         35        SEND_VAL                                                 1000
         36        SEND_VAL                                                 10000
         37        DO_ICALL                                         $28     
         38        SEND_VAR_NO_REF_EX                                       $28, 'price'
         39        SEND_VAR_EX                                              !4, 'items'
         40        CHECK_UNDEF_ARGS                                         
         41        DO_FCALL                                      1          
         42        ASSIGN                                                   !7, $24
  255    43        ASSIGN_DIM                                               !2
         44        OP_DATA                                                  !7
  247    45        PRE_INC                                                  !3
         46    >   IS_SMALLER_OR_EQUAL                                      !3, 10
         47      > JMPNZ                                                    ~33, ->6
  257    48    >   NEW                                              $35     'Product'
         49        CONCAT                                           ~36     'Product', !1
         50        SEND_VAL_EX                                              ~36, 'title'
         51        CONCAT                                           ~37     'Product+', !1
         52        CONCAT                                           ~38     ~37, '+Description'
         53        SEND_VAL_EX                                              ~38, 'description'
         54        INIT_FCALL                                               'random_int'
         55        SEND_VAL                                                 1000
         56        SEND_VAL                                                 10000
         57        DO_ICALL                                         $39     
         58        SEND_VAR_NO_REF_EX                                       $39, 'price'
         59        SEND_VAL_EX                                              'USD', 'currency'
         60        CONCAT                                           ~40     'Category', !1
         61        SEND_VAL_EX                                              ~40, 'category'
         62        CONCAT                                           ~41     'Brand', !1
         63        SEND_VAL_EX                                              ~41, 'brand'
         64        SEND_VAR_EX                                              !2, 'options'
         65        CHECK_UNDEF_ARGS                                         
         66        DO_FCALL                                      1          
         67        ASSIGN_DIM                                               !0
         68        OP_DATA                                                  $35
  245    69        PRE_INC                                                  !1
         70    >   IS_SMALLER_OR_EQUAL                                      !1, 100
         71      > JMPNZ                                                    ~44, ->3
  258    72    > > RETURN                                                   1

Class Product:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CU0MC
function name:  __construct
number of ops:  22
compiled vars:  !0 = $title, !1 = $description, !2 = $price, !3 = $currency, !4 = $category, !5 = $brand, !6 = $options
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
          3        RECV                                             !3      
          4        RECV                                             !4      
          5        RECV                                             !5      
          6        RECV                                             !6      
   23     7        ASSIGN_OBJ                                               'title'
          8        OP_DATA                                                  !0
   24     9        ASSIGN_OBJ                                               'description'
         10        OP_DATA                                                  !1
   25    11        ASSIGN_OBJ                                               'price'
         12        OP_DATA                                                  !2
   26    13        ASSIGN_OBJ                                               'currency'
         14        OP_DATA                                                  !3
   27    15        ASSIGN_OBJ                                               'category'
         16        OP_DATA                                                  !4
   28    17        ASSIGN_OBJ                                               'brand'
         18        OP_DATA                                                  !5
   29    19        ASSIGN_OBJ                                               'options'
         20        OP_DATA                                                  !6
   30    21      > 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/CU0MC
function name:  getTitle
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   37     0  E >   FETCH_OBJ_R                                      ~0      'title'
          1        VERIFY_RETURN_TYPE                                       ~0
          2      > RETURN                                                   ~0
   38     3*       VERIFY_RETURN_TYPE                                       
          4*     > RETURN                                                   null

End of function gettitle

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

End of function settitle

Function getdescription:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CU0MC
function name:  getDescription
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   53     0  E >   FETCH_OBJ_R                                      ~0      'description'
          1        VERIFY_RETURN_TYPE                                       ~0
          2      > RETURN                                                   ~0
   54     3*       VERIFY_RETURN_TYPE                                       
          4*     > RETURN                                                   null

End of function getdescription

Function setdescription:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CU0MC
function name:  setDescription
number of ops:  4
compiled vars:  !0 = $description
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   59     0  E >   RECV                                             !0      
   61     1        ASSIGN_OBJ                                               'description'
          2        OP_DATA                                                  !0
   62     3      > RETURN                                                   null

End of function setdescription

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

End of function getprice

Function setprice:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CU0MC
function name:  setPrice
number of ops:  4
compiled vars:  !0 = $price
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   75     0  E >   RECV                                             !0      
   77     1        ASSIGN_OBJ                                               'price'
          2        OP_DATA                                                  !0
   78     3      > RETURN                                                   null

End of function setprice

Function getcurrency:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CU0MC
function name:  getCurrency
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   85     0  E >   FETCH_OBJ_R                                      ~0      'currency'
          1        VERIFY_RETURN_TYPE                                       ~0
          2      > RETURN                                                   ~0
   86     3*       VERIFY_RETURN_TYPE                                       
          4*     > RETURN                                                   null

End of function getcurrency

Function setcurrency:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CU0MC
function name:  setCurrency
number of ops:  4
compiled vars:  !0 = $currency
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   91     0  E >   RECV                                             !0      
   93     1        ASSIGN_OBJ                                               'currency'
          2        OP_DATA                                                  !0
   94     3      > RETURN                                                   null

End of function setcurrency

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

End of function getcategory

Function setcategory:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CU0MC
function name:  setCategory
number of ops:  4
compiled vars:  !0 = $category
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  107     0  E >   RECV                                             !0      
  109     1        ASSIGN_OBJ                                               'category'
          2        OP_DATA                                                  !0
  110     3      > RETURN                                                   null

End of function setcategory

Function getbrand:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CU0MC
function name:  getBrand
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  117     0  E >   FETCH_OBJ_R                                      ~0      'brand'
          1        VERIFY_RETURN_TYPE                                       ~0
          2      > RETURN                                                   ~0
  118     3*       VERIFY_RETURN_TYPE                                       
          4*     > RETURN                                                   null

End of function getbrand

Function setbrand:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CU0MC
function name:  setBrand
number of ops:  4
compiled vars:  !0 = $brand
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  123     0  E >   RECV                                             !0      
  125     1        ASSIGN_OBJ                                               'brand'
          2        OP_DATA                                                  !0
  126     3      > RETURN                                                   null

End of function setbrand

Function getoptions:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CU0MC
function name:  getOptions
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  133     0  E >   FETCH_OBJ_R                                      ~0      'options'
          1        VERIFY_RETURN_TYPE                                       ~0
          2      > RETURN                                                   ~0
  134     3*       VERIFY_RETURN_TYPE                                       
          4*     > RETURN                                                   null

End of function getoptions

Function setoptions:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CU0MC
function name:  setOptions
number of ops:  4
compiled vars:  !0 = $options
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  139     0  E >   RECV                                             !0      
  141     1        ASSIGN_OBJ                                               'options'
          2        OP_DATA                                                  !0
  142     3      > RETURN                                                   null

End of function setoptions

End of class Product.

Class Option:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CU0MC
function name:  __construct
number of ops:  13
compiled vars:  !0 = $title, !1 = $description, !2 = $price, !3 = $items
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  161     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
          3        RECV                                             !3      
  163     4        ASSIGN_OBJ                                               'title'
          5        OP_DATA                                                  !0
  164     6        ASSIGN_OBJ                                               'description'
          7        OP_DATA                                                  !1
  165     8        ASSIGN_OBJ                                               'price'
          9        OP_DATA                                                  !2
  166    10        ASSIGN_OBJ                                               'items'
         11        OP_DATA                                                  !3
  167    12      > 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/CU0MC
function name:  setTitle
number of ops:  4
compiled vars:  !0 = $title
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  172     0  E >   RECV                                             !0      
  174     1        ASSIGN_OBJ                                               'title'
          2        OP_DATA                                                  !0
  175     3      > RETURN                                                   null

End of function settitle

Function setdescription:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CU0MC
function name:  setDescription
number of ops:  4
compiled vars:  !0 = $description
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  180     0  E >   RECV                                             !0      
  182     1        ASSIGN_OBJ                                               'description'
          2        OP_DATA                                                  !0
  183     3      > RETURN                                                   null

End of function setdescription

Function setprice:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CU0MC
function name:  setPrice
number of ops:  4
compiled vars:  !0 = $price
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  188     0  E >   RECV                                             !0      
  190     1        ASSIGN_OBJ                                               'price'
          2        OP_DATA                                                  !0
  191     3      > RETURN                                                   null

End of function setprice

Function setitems:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CU0MC
function name:  setItems
number of ops:  4
compiled vars:  !0 = $items
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  196     0  E >   RECV                                             !0      
  198     1        ASSIGN_OBJ                                               'items'
          2        OP_DATA                                                  !0
  199     3      > RETURN                                                   null

End of function setitems

End of class Option.

Class OptionItem:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CU0MC
function name:  __construct
number of ops:  10
compiled vars:  !0 = $title, !1 = $description, !2 = $price
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  212     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
  214     3        ASSIGN_OBJ                                               'title'
          4        OP_DATA                                                  !0
  215     5        ASSIGN_OBJ                                               'description'
          6        OP_DATA                                                  !1
  216     7        ASSIGN_OBJ                                               'price'
          8        OP_DATA                                                  !2
  217     9      > 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/CU0MC
function name:  setTitle
number of ops:  4
compiled vars:  !0 = $title
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  222     0  E >   RECV                                             !0      
  224     1        ASSIGN_OBJ                                               'title'
          2        OP_DATA                                                  !0
  225     3      > RETURN                                                   null

End of function settitle

Function setdescription:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CU0MC
function name:  setDescription
number of ops:  4
compiled vars:  !0 = $description
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  230     0  E >   RECV                                             !0      
  232     1        ASSIGN_OBJ                                               'description'
          2        OP_DATA                                                  !0
  233     3      > RETURN                                                   null

End of function setdescription

Function setprice:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CU0MC
function name:  setPrice
number of ops:  4
compiled vars:  !0 = $price
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  238     0  E >   RECV                                             !0      
  240     1        ASSIGN_OBJ                                               'price'
          2        OP_DATA                                                  !0
  241     3      > RETURN                                                   null

End of function setprice

End of class OptionItem.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
145.24 ms | 1480 KiB | 14 Q