@ 2024-12-02T13:43:40Z <?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);
}
Enable javascript to submit You have javascript disabled. You will not be able to edit any code.
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).
Version System time (s) User time (s) Memory (MiB) 8.4.1 0.073 0.060 42.55 8.3.14 0.115 0.043 41.41 8.3.13 0.101 0.029 41.70 8.3.12 0.081 0.040 41.55 8.3.11 0.057 0.064 41.46 8.3.10 0.086 0.046 41.58 8.3.9 0.064 0.048 42.02 8.3.8 0.105 0.049 41.91 8.3.7 0.090 0.066 41.69 8.3.6 0.126 0.030 41.78 8.3.5 0.082 0.026 41.80 8.3.4 0.074 0.042 42.85 8.3.3 0.068 0.058 42.84 8.3.2 0.084 0.046 42.86 8.3.1 0.098 0.029 42.70 8.3.0 0.074 0.034 42.79 8.2.26 0.085 0.037 41.58 8.2.25 0.100 0.056 41.20 8.2.24 0.081 0.042 41.47 8.2.23 0.070 0.050 41.61 8.2.22 0.105 0.036 41.59 8.2.21 0.083 0.035 41.19 8.2.20 0.116 0.037 41.30 8.2.19 0.087 0.037 41.21 8.2.18 0.086 0.048 41.08 8.2.17 0.097 0.056 42.96 8.2.16 0.096 0.056 42.44 8.2.15 0.079 0.045 42.52 8.2.14 0.073 0.047 42.57 8.2.13 0.087 0.042 42.52 8.2.12 0.126 0.026 42.32 8.2.11 0.083 0.033 42.56 8.2.10 0.112 0.037 42.70 8.2.9 0.066 0.056 42.62 8.2.8 0.079 0.048 42.80 8.2.7 0.084 0.034 42.86 8.2.6 0.089 0.023 42.45 8.2.5 0.070 0.060 42.68 8.2.4 0.056 0.053 43.35 8.2.3 0.089 0.020 43.01 8.2.2 0.102 0.014 42.85 8.2.1 0.100 0.048 42.52 8.2.0 0.102 0.037 42.55
preferences:dark mode live preview
28.74 ms | 403 KiB | 5 Q