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); }

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
8.4.10.0730.06042.55
8.3.140.1150.04341.41
8.3.130.1010.02941.70
8.3.120.0810.04041.55
8.3.110.0570.06441.46
8.3.100.0860.04641.58
8.3.90.0640.04842.02
8.3.80.1050.04941.91
8.3.70.0900.06641.69
8.3.60.1260.03041.78
8.3.50.0820.02641.80
8.3.40.0740.04242.85
8.3.30.0680.05842.84
8.3.20.0840.04642.86
8.3.10.0980.02942.70
8.3.00.0740.03442.79
8.2.260.0850.03741.58
8.2.250.1000.05641.20
8.2.240.0810.04241.47
8.2.230.0700.05041.61
8.2.220.1050.03641.59
8.2.210.0830.03541.19
8.2.200.1160.03741.30
8.2.190.0870.03741.21
8.2.180.0860.04841.08
8.2.170.0970.05642.96
8.2.160.0960.05642.44
8.2.150.0790.04542.52
8.2.140.0730.04742.57
8.2.130.0870.04242.52
8.2.120.1260.02642.32
8.2.110.0830.03342.56
8.2.100.1120.03742.70
8.2.90.0660.05642.62
8.2.80.0790.04842.80
8.2.70.0840.03442.86
8.2.60.0890.02342.45
8.2.50.0700.06042.68
8.2.40.0560.05343.35
8.2.30.0890.02043.01
8.2.20.1020.01442.85
8.2.10.1000.04842.52
8.2.00.1020.03742.55

preferences:
28.74 ms | 403 KiB | 5 Q