3v4l.org

run code in 300+ PHP versions simultaneously
<?php final class CommandId { private $name; private $time; private $hash; public function __construct($name, $time = null, $hash = null) { $this->time = $time ?: microtime(true); $this->name = trim($name); $this->hash = $hash ?: hash('crc32', rand(0, $this->time)); if (empty($this->name)) { throw new DomainException('Name must not be empty'); } } public static function fromString($idString) { $parts = explode('_', $idString); if (count($parts) != 3) { throw new DomainException("Unexpected format [$idString]"); } return new static($parts[0], (float) $parts[1], $parts[2]); } public function name() { return $this->name; } public function time() { return $this->time; } public function equals(self $other) { return ( $this->name == $other->name && $this->time == $other->time && $this->hash == $other->hash ); } public function __toString() { return implode('_', [$this->name, $this->time, $this->hash]); } } $one = new CommandId('foo'); $two = CommandId::fromString((string) $one); assert($one->equals($two)); var_dump((string) $one, (string) $two);

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)
7.2.00.0070.01019.53
7.1.70.0040.00417.06
7.1.60.0070.01419.43
7.1.50.0100.01616.94
7.1.00.0030.07022.46
7.0.200.0190.00316.50
7.0.140.0070.06722.07
7.0.60.0030.07019.95
7.0.50.0030.05018.00
7.0.40.0070.04320.05
7.0.30.0270.08720.33
7.0.20.0330.07720.06
7.0.10.0100.07020.12
7.0.00.0170.07320.31
5.6.280.0000.07721.00
5.6.210.0100.06720.68
5.6.200.0030.04318.29
5.6.190.0130.09320.57
5.6.180.0330.06020.41
5.6.170.0230.05320.62
5.6.160.0030.06720.50
5.6.150.0070.07318.19
5.6.140.0030.04718.21
5.6.130.0000.04318.18
5.6.120.0030.06721.13
5.6.110.0130.07021.05
5.6.100.0030.06320.99
5.6.90.0030.09020.91
5.6.80.0070.08020.29
5.5.350.4300.04720.46
5.5.340.0030.08317.95
5.5.330.0170.06720.35
5.5.320.0170.04320.35
5.5.310.0400.07720.18
5.5.300.0000.07718.04
5.5.290.0100.07718.04
5.5.280.0070.04720.99
5.5.270.0130.07020.85
5.5.260.0030.08720.86
5.5.250.0030.08020.79
5.5.240.0200.07020.27
5.4.450.0300.06019.68
5.4.440.0370.07319.59
5.4.430.0230.04019.15
5.4.420.0230.05319.25
5.4.410.0330.06019.46
5.4.400.0300.05719.06
5.4.390.0330.07018.90
5.4.380.0230.05319.17
5.4.370.0300.07718.95
5.4.360.0330.06318.82
5.4.350.0330.06719.27
5.4.340.0230.04018.95
5.4.320.0330.04019.11
5.4.310.0300.03019.19
5.4.300.0130.04318.80
5.4.290.0170.04019.11
5.4.280.0170.04018.83
5.4.270.0270.03018.93
5.4.260.0170.05719.10
5.4.250.0270.04719.10
5.4.240.0230.03718.89
5.4.230.0230.03319.11
5.4.220.0130.04019.17
5.4.210.0200.03718.94
5.4.200.0070.04018.82
5.4.190.0170.03318.82
5.4.180.0230.03019.21
5.4.170.0270.03318.82
5.4.160.0130.03718.81
5.4.150.0170.03718.88
5.4.140.0170.03716.43
5.4.130.0070.04316.54
5.4.120.0230.03716.44
5.4.110.0230.05316.42
5.4.100.0270.06716.46
5.4.90.0230.07316.52
5.4.80.0230.06316.42
5.4.70.0300.07016.29
5.4.60.0230.06716.44
5.4.50.0230.05016.57
5.4.40.0300.05016.22
5.4.30.0330.06016.48
5.4.20.0230.06716.50
5.4.10.0270.06716.43
5.4.00.0270.07015.81
5.3.290.0270.03314.70
5.3.280.0130.04314.63
5.3.270.0130.04014.70
5.3.260.0070.04714.64
5.3.250.0130.03714.63
5.3.240.0200.06314.61
5.3.230.0170.03714.59
5.3.220.0300.05014.57
5.3.210.0230.07014.56
5.3.200.0200.06714.59
5.3.190.0230.03714.50
5.3.180.0230.04014.55
5.3.170.0470.05314.57
5.3.160.0200.05014.80
5.3.150.0270.06714.59
5.3.140.0300.07014.50
5.3.130.0300.04314.54
5.3.120.0270.07314.72
5.3.110.0230.04014.47
5.3.100.0170.05014.03
5.3.90.0200.03314.02
5.3.80.0130.04014.11
5.3.70.0200.05714.21
5.3.60.0170.04014.13
5.3.50.0330.06313.87
5.3.40.0270.04313.96
5.3.30.0300.06313.85
5.3.20.0170.04313.79
5.3.10.0270.04013.58
5.3.00.0230.05013.73
5.2.170.0270.05311.13
5.2.160.0200.04311.37
5.2.150.0270.05711.11
5.2.140.0130.03311.05
5.2.130.0200.04711.07
5.2.120.0100.03711.12
5.2.110.0270.05711.11
5.2.100.0170.06011.11
5.2.90.0230.05711.22
5.2.80.0170.06011.10
5.2.70.0170.03711.18
5.2.60.0200.04011.16
5.2.50.0230.06010.93
5.2.40.0170.05711.07
5.2.30.0130.04311.02
5.2.20.0070.04010.87
5.2.10.0230.05010.78
5.2.00.0230.03310.72
5.1.60.0170.0239.98
5.1.50.0100.05310.05
5.1.40.0200.0309.88
5.1.30.0130.03310.50
5.1.20.0130.03010.25
5.1.10.0300.03310.00
5.1.00.0230.05010.22
5.0.50.0130.0339.29
5.0.40.0130.0309.29
5.0.30.0100.0609.29
5.0.20.0100.0479.29
5.0.10.0100.0439.29
5.0.00.0070.0509.29
4.4.90.0100.0379.29
4.4.80.0070.0409.29
4.4.70.0130.0309.29
4.4.60.0070.0209.29
4.4.50.0130.0339.29
4.4.40.0100.0539.29
4.4.30.0100.0239.29
4.4.20.0100.0339.29
4.4.10.0100.0309.29
4.4.00.0070.0439.29
4.3.110.0100.0379.29
4.3.100.0070.0279.29
4.3.90.0100.0339.29
4.3.80.0100.0279.29
4.3.70.0070.0239.29
4.3.60.0070.0339.29
4.3.50.0100.0339.29
4.3.40.0100.0439.29
4.3.30.0070.0209.29
4.3.20.0030.0239.29
4.3.10.0030.0209.29
4.3.00.0000.0179.29

preferences:
33.68 ms | 400 KiB | 5 Q