3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Rectangle { public int $area { get => $this->height * $this->width; } public function __construct( public int $height, public int $width, ) {} public function __serialize(): array { $properties = new ReflectionClass($this)->getProperties(); return array_reduce($properties, fn (array $values, ReflectionProperty $property): array => [ ...$values, $property->getName() => $property->getValue($this), ], []); } public function __unserialize(array $values): void { $properties = new ReflectionClass($this)->getProperties(); foreach ($properties as $property) { $value = $values[$property->getName()]; $property->setValue($this, $value); } } } $instance = new Rectangle(4, 5); $serialized = serialize($instance); var_dump($serialized); $unserialized = unserialize($serialized); var_dump($unserialized);

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.0170.00717.91
8.3.140.0400.00716.84
8.3.130.0350.00716.36
8.3.120.0340.00716.46
8.3.110.0310.01017.00
8.3.100.0300.01616.85
8.3.90.0390.01116.45
8.3.80.0410.00716.43
8.3.70.0330.01016.29
8.3.60.0220.00616.38
8.3.50.0330.00916.48
8.3.40.0190.00617.48
8.3.30.0340.00617.35
8.3.20.0300.00917.46
8.3.10.0260.01017.68
8.3.00.0120.00917.45
8.2.260.0240.01416.46
8.2.250.0340.00416.56
8.2.240.0290.00616.40
8.2.230.0340.00716.26
8.2.220.0330.00816.33
8.2.210.0380.00316.70
8.2.200.0330.00716.39
8.2.190.0310.00916.26
8.2.180.0360.00016.48
8.2.170.0390.00417.37
8.2.160.0340.00717.45
8.2.150.0400.00417.57
8.2.140.0330.00817.35
8.2.130.0350.00617.17
8.2.120.0360.00617.36
8.2.110.0290.01317.30
8.2.100.0270.01417.05
8.2.90.0220.00417.48
8.2.80.0380.00417.32
8.2.70.0440.00617.29
8.2.60.0430.00917.19
8.2.50.0250.01417.40
8.2.40.0290.00717.34
8.2.30.0300.00717.40
8.2.20.0300.01317.11
8.2.10.0210.00917.09
8.2.00.0300.00717.06

preferences:
148.86 ms | 1005 KiB | 7 Q