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 = (float) $parts[1]; $id->hash = $parts[2]; return $id; } public function name() { return $this->name; } public function time() { return $this->time; } public function __toString() { return "{$this->name}_{$this->time}_{$this->hash}"; } } $one = new CommandId('foo'); $two = new CommandId('foo'); assert($one != $two); var_dump($one, $two, (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.3.10.0130.00616.30
7.3.00.0140.00716.64
7.2.130.0170.00316.61
7.2.120.0140.00317.14
7.2.110.0090.00616.89
7.2.100.0120.00816.52
7.2.90.0110.00816.63
7.2.80.0090.00816.61
7.2.70.0180.00716.94
7.2.60.0160.00616.79
7.2.50.0070.01016.52
7.2.40.0070.01816.79
7.2.30.0130.00616.46
7.2.20.0090.00916.40
7.2.10.0140.00616.85
7.2.00.0080.00818.03
7.1.250.0140.00815.77
7.1.70.0000.00817.07
7.1.60.0120.00919.43
7.1.50.0090.01516.70
7.1.00.0070.03022.27
7.0.200.0160.00616.77
7.0.140.0030.07322.04
7.0.60.0030.08719.93
7.0.50.0030.07317.73
7.0.40.0070.05020.09
7.0.30.0270.06020.11
7.0.20.0330.04720.06
7.0.10.0270.05320.10
7.0.00.0200.07020.09
5.6.280.0000.07720.82
5.6.210.0070.07020.73
5.6.200.0100.08318.19
5.6.190.0030.06320.45
5.6.180.0270.04720.67
5.6.170.0330.07720.50
5.6.160.0000.06720.51
5.6.150.0030.04318.27
5.6.140.0100.08018.21
5.6.130.0070.05018.17
5.6.120.0070.08320.90
5.6.110.0030.04021.05
5.6.100.0070.04021.14
5.6.90.0130.07321.11
5.6.80.0130.08320.41
5.6.70.0330.06020.48
5.5.350.0030.08720.36
5.5.340.0070.04317.99
5.5.330.0070.07720.47
5.5.320.0200.04320.40
5.5.310.0300.07720.50
5.5.300.0000.08317.99
5.5.290.0070.07317.95
5.5.280.0170.08020.89
5.5.270.0070.08020.69
5.5.260.0070.08020.85
5.5.250.0100.03320.51
5.5.240.0070.06720.28
5.4.450.0100.05719.33
5.4.440.0830.05319.47
5.4.430.1030.04719.47
5.4.420.0900.04719.30
5.4.410.1070.06019.26
5.4.400.1630.04718.73
5.4.390.0230.06718.61
5.4.380.0230.05718.80
5.4.370.0130.05318.73
5.4.360.0200.04718.75
5.4.350.0050.04012.03
5.4.340.0110.03912.03
5.4.320.0050.03612.51
5.4.310.0040.03912.51
5.4.300.0070.03512.51
5.4.290.0030.03912.51
5.4.280.0040.03612.41
5.4.270.0050.03612.41
5.4.260.0050.04012.40
5.4.250.0070.05318.77
5.4.240.0130.05318.89
5.4.230.0070.05319.00
5.4.220.0130.05318.79
5.4.210.0170.04718.95
5.4.200.0100.06718.76
5.4.190.0100.05018.73
5.4.180.0130.04718.99
5.4.170.0200.04018.89
5.4.160.0100.06018.90
5.4.150.0100.06018.73
5.4.140.0170.07016.56
5.4.130.0070.04716.56
5.4.120.0070.05316.59
5.4.110.0170.06316.42
5.4.100.0070.05016.62
5.4.90.0030.05716.57
5.4.80.0070.05316.39
5.4.70.0030.05016.61
5.4.60.0030.05716.54
5.4.50.0170.06016.33
5.4.40.0070.07016.35
5.4.30.0070.05016.47
5.4.20.0030.05016.32
5.4.10.0030.05716.42
5.4.00.0070.06715.99
5.3.290.0040.04012.80
5.3.280.0070.07314.75
5.3.270.0130.04714.76
5.3.260.0130.04314.69
5.3.250.0070.06014.68
5.3.240.0100.07314.45
5.3.230.0130.04714.52
5.3.220.0170.05014.59
5.3.210.0070.05014.65
5.3.200.0070.04714.65
5.3.190.0070.05314.65
5.3.180.0230.06014.41
5.3.170.0100.05314.74
5.3.160.0030.06314.80
5.3.150.0070.05014.68
5.3.140.0070.05014.57
5.3.130.0070.05314.47
5.3.120.0070.05314.64
5.3.110.0070.07314.58
5.3.100.0030.05314.13
5.3.90.0170.04314.00
5.3.80.0130.04014.11
5.3.70.0070.05014.20
5.3.60.0030.05313.97
5.3.50.0030.05314.02
5.3.40.0200.05314.18
5.3.30.0070.05313.99
5.3.20.0070.05313.71
5.3.10.0070.05713.88
5.3.00.0030.07713.55
5.2.170.0030.04711.32
5.2.160.0100.05711.13
5.2.150.0030.05711.13
5.2.140.0130.05011.37
5.2.130.0070.05310.94
5.2.120.0000.05010.94
5.2.110.0070.04011.19
5.2.100.0100.03711.01
5.2.90.0130.03711.09
5.2.80.0030.06311.08
5.2.70.0130.05011.27
5.2.60.0130.04311.13
5.2.50.0130.03311.02
5.2.40.0170.04311.18
5.2.30.0070.04011.06
5.2.20.0100.03710.96
5.2.10.0070.05310.91
5.2.00.0030.04010.81
5.1.60.0100.03010.23
5.1.50.0030.05010.23
5.1.40.0200.02010.23
5.1.30.0070.03710.23
5.1.20.0030.04010.35
5.1.10.0030.03710.23
5.1.00.0100.03010.23
5.0.50.0070.02710.23
5.0.40.0030.02710.23
5.0.30.0030.05010.23
5.0.20.0130.03710.23
5.0.10.0070.02710.23
5.0.00.0070.04010.23
4.4.90.0030.02310.23
4.4.80.0070.01710.23
4.4.70.0000.02310.23
4.4.60.0070.02010.23
4.4.50.0030.03310.23
4.4.40.0000.04010.23
4.4.30.0030.02010.23
4.4.20.0000.02710.23
4.4.10.0030.02710.23
4.4.00.0030.03010.23
4.3.110.0070.02010.23
4.3.100.0030.02010.23
4.3.90.0070.01710.23
4.3.80.0100.03310.23
4.3.70.0030.03010.23
4.3.60.0070.01710.23
4.3.50.0100.02310.23
4.3.40.0030.03310.23
4.3.30.0070.02010.23
4.3.20.0000.02310.23
4.3.10.0030.02310.23
4.3.00.0100.0235.77

preferences:
33.04 ms | 401 KiB | 5 Q