3v4l.org

run code in 300+ PHP versions simultaneously
<?php final class CommandId { private $name; private $time; private $hash; public function __construct($name) { $this->time = microtime(true); $this->name = trim($name); $this->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]"); } $id = new static($parts[0]); $id->time = floatval($parts[1]); $id->hash = $parts[2]; return $id; } public function name() { return $this->name; } public function time() { return $this->time; } public function equals(self $other) { return ((string) $this == (string) $other); } public function __toString() { return implode('_', [$this->name, $this->time, $this->hash]); } } $one = new CommandId('foo'); $two = CommandId::fromString((string) $one); var_dump($one, $two, $one->equals($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.4.00.0030.01414.90
7.3.120.0050.01214.91
7.3.110.0080.00814.92
7.3.100.0090.00514.68
7.3.90.0080.00714.82
7.3.80.0120.00515.08
7.3.70.0080.00714.85
7.3.60.0090.00814.96
7.3.50.0030.01314.90
7.3.40.0050.00814.71
7.3.30.0130.00314.75
7.3.20.0030.01216.49
7.3.10.0060.00716.72
7.3.00.0040.01116.76
7.2.250.0060.00914.78
7.2.240.0050.01415.10
7.2.230.0020.01215.04
7.2.220.0080.00814.99
7.2.210.0080.00814.75
7.2.200.0110.00715.14
7.2.190.0040.01315.18
7.2.180.0080.00615.10
7.2.170.0050.01015.15
7.2.160.0120.00315.01
7.2.150.0070.00417.09
7.2.140.0060.01017.13
7.2.130.0040.00817.02
7.2.120.0050.00916.94
7.2.110.0080.00816.94
7.2.100.0050.01117.09
7.2.90.0080.00717.23
7.2.80.0050.00816.92
7.2.70.0070.00817.09
7.2.60.0020.01517.07
7.2.50.0050.01017.04
7.2.40.0100.00517.13
7.2.30.0040.01016.94
7.2.20.0080.00517.10
7.2.10.0060.00917.12
7.2.00.0050.00917.79
7.1.330.0030.01415.87
7.1.320.0030.01115.59
7.1.310.0090.00715.88
7.1.300.0080.00515.87
7.1.290.0100.00515.63
7.1.280.0080.00615.82
7.1.270.0040.01015.76
7.1.260.0070.00715.85
7.1.250.0080.00615.84
7.1.70.0000.01117.22
7.1.60.0110.01419.43
7.1.50.0030.00916.89
7.1.00.0070.03022.44
7.0.200.0070.00416.64
7.0.140.0070.07322.00
7.0.60.0170.07020.00
7.0.50.0130.06717.90
7.0.40.0030.06020.13
7.0.30.0430.06320.09
7.0.20.0130.05020.12
7.0.10.0370.07020.25
7.0.00.0100.06020.05
5.6.280.0070.07021.04
5.6.210.0100.08320.57
5.6.200.0100.07718.15
5.6.190.0000.04720.76
5.6.180.0270.08020.63
5.6.170.0370.03720.54
5.6.160.0100.04320.43
5.6.150.0000.05318.23
5.6.140.0030.04018.21
5.6.130.0100.08018.15
5.6.120.0130.06321.07
5.6.110.0070.06021.00
5.6.100.0100.03320.96
5.6.90.0170.07021.13
5.6.80.0100.07020.38
5.6.70.0270.07020.37
5.5.350.0030.03320.45
5.5.340.0070.05017.99
5.5.330.0070.04320.18
5.5.320.0200.08020.35
5.5.310.0270.07720.30
5.5.300.0030.07017.98
5.5.290.0030.04318.09
5.5.280.0100.08720.96
5.5.270.0030.04020.82
5.5.260.0100.08020.77
5.5.250.0100.07720.70
5.5.240.0100.04720.05
5.4.450.0900.04719.72
5.4.440.0970.06319.70
5.4.430.0830.05719.59
5.4.420.1030.05719.45
5.4.410.1100.06019.34
5.4.400.0500.05018.78
5.4.390.0370.05318.84
5.4.380.0300.04718.76
5.4.370.0230.04018.73
5.4.360.0100.05718.75
5.4.350.0090.03412.03
5.4.340.0060.03512.03
5.4.320.0060.03712.51
5.4.310.0080.03712.51
5.4.300.0050.03612.52
5.4.290.0060.03712.51
5.4.280.0070.03412.40
5.4.270.0100.03312.41
5.4.260.0040.04312.41
5.4.250.0100.05019.09
5.4.240.0100.05318.96
5.4.230.0070.05319.09
5.4.220.0030.05718.94
5.4.210.0170.06018.94
5.4.200.0100.07318.78
5.4.190.0100.05018.97
5.4.180.0070.05318.82
5.4.170.0130.05318.83
5.4.160.0200.06718.64
5.4.150.0100.07318.94
5.4.140.0100.05016.59
5.4.130.0100.06016.36
5.4.120.0030.05716.59
5.4.110.0100.06316.47
5.4.100.0130.05016.40
5.4.90.0130.06716.51
5.4.80.0170.04316.39
5.4.70.0070.05016.40
5.4.60.0100.06716.48
5.4.50.0230.03316.38
5.4.40.0030.06016.59
5.4.30.0100.05716.46
5.4.20.0070.06316.38
5.4.10.0070.06016.38
5.4.00.0070.05315.98
5.3.290.0090.03512.80
5.3.280.0100.05014.60
5.3.270.0100.06014.64
5.3.260.0130.05714.80
5.3.250.0130.05014.64
5.3.240.0070.07314.45
5.3.230.0030.08014.59
5.3.220.0170.04314.77
5.3.210.0230.05714.76
5.3.200.0070.06314.60
5.3.190.0130.04714.78
5.3.180.0130.05014.48
5.3.170.0100.06714.76
5.3.160.0130.06314.56
5.3.150.0130.04314.66
5.3.140.0100.05314.66
5.3.130.0130.05014.73
5.3.120.0130.05014.47
5.3.110.0030.06314.59
5.3.100.0170.04714.04
5.3.90.0170.06314.13
5.3.80.0030.05013.87
5.3.70.0030.07313.94
5.3.60.0200.04314.10
5.3.50.0100.05713.87
5.3.40.0270.05314.05
5.3.30.0030.05013.75
5.3.20.0170.03713.80
5.3.10.0000.06013.64
5.3.00.0070.05713.72
5.2.170.0030.04311.15
5.2.160.0070.04010.98
5.2.150.0000.04711.24
5.2.140.0100.04711.22
5.2.130.0030.04311.11
5.2.120.0000.05711.09
5.2.110.0070.05011.18
5.2.100.0100.04711.20
5.2.90.0030.04311.27
5.2.80.0100.05011.33
5.2.70.0100.04011.08
5.2.60.0030.05011.28
5.2.50.0030.04311.10
5.2.40.0070.05010.91
5.2.30.0070.04311.14
5.2.20.0000.06011.14
5.2.10.0100.03310.87
5.2.00.0070.03710.80
5.1.60.0070.03310.08
5.1.50.0030.04010.06
5.1.40.0030.03710.04
5.1.30.0100.03010.50
5.1.20.0030.03710.43
5.1.10.0100.03710.28
5.1.00.0100.0339.92
5.0.50.0100.0238.56
5.0.40.0000.0308.57
5.0.30.0000.0438.18
5.0.20.0070.0238.27
5.0.10.0000.0308.16
5.0.00.0000.0678.41
4.4.90.0030.0307.38
4.4.80.0000.0307.38
4.4.70.0030.0207.38
4.4.60.0030.0207.38
4.4.50.0030.0177.38
4.4.40.0030.0337.38
4.4.30.0070.0237.38
4.4.20.0030.0237.38
4.4.10.0000.0207.38
4.4.00.0070.0377.38
4.3.110.0000.0277.38
4.3.100.0000.0277.38
4.3.90.0000.0307.38
4.3.80.0000.0477.38
4.3.70.0030.0207.38
4.3.60.0000.0237.38
4.3.50.0030.0207.38
4.3.40.0030.0407.38
4.3.30.0000.0237.38
4.3.20.0000.0337.38
4.3.10.0000.0237.38
4.3.00.0100.0235.83

preferences:
31.52 ms | 401 KiB | 5 Q