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 = (float) ($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], $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); 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.3.10.0080.00816.55
7.3.00.0100.00916.73
7.2.130.0110.01116.66
7.2.120.0080.00817.06
7.2.110.0130.00316.91
7.2.100.0080.00416.96
7.2.90.0160.00316.80
7.2.80.0060.00616.98
7.2.70.0140.00016.99
7.2.60.0030.01416.61
7.2.50.0110.00416.77
7.2.40.0040.00717.07
7.2.30.0040.00816.89
7.2.20.0030.01017.03
7.2.10.0030.00716.77
7.2.00.0040.00818.36
7.1.250.0090.00415.55
7.1.70.0000.00717.25
7.1.60.0180.00719.43
7.1.50.0070.01416.69
7.1.00.0000.05022.33
7.0.200.0170.00716.69
7.0.140.0130.06321.95
7.0.60.0070.06320.04
7.0.50.0130.06317.98
7.0.40.0000.05720.15
7.0.30.0400.07020.17
7.0.20.0200.05020.26
7.0.10.0400.07020.24
7.0.00.0130.08720.07
5.6.280.0000.07721.14
5.6.210.0070.06720.63
5.6.200.0130.07318.13
5.6.190.0030.04720.32
5.6.180.0230.05020.41
5.6.170.0470.07320.55
5.6.160.0130.07020.43
5.6.150.0170.07018.16
5.6.140.0170.07318.14
5.6.130.0070.08318.16
5.6.120.0030.06021.02
5.6.110.0000.04321.02
5.6.100.0030.04021.02
5.6.90.0030.08720.97
5.6.80.0070.05720.54
5.6.70.0370.05020.40
5.5.350.0100.05020.32
5.5.340.0000.09017.93
5.5.330.0070.05720.40
5.5.320.0270.05320.27
5.5.310.0230.05720.18
5.5.300.0000.05017.98
5.5.290.0070.08018.10
5.5.280.0270.06320.91
5.5.270.0170.06020.91
5.5.260.0070.06020.89
5.5.250.0030.08020.68
5.5.240.0070.06720.20
5.4.450.1570.04019.52
5.4.440.1700.04719.64
5.4.430.1530.04019.47
5.4.420.1630.04719.48
5.4.410.1530.04019.27
5.4.400.1600.03719.02
5.4.390.1430.04019.15
5.4.380.1570.04018.84
5.4.370.1670.03319.20
5.4.360.1700.03019.35
5.4.350.1870.04319.14
5.4.340.1270.03718.98
5.4.320.1670.03319.06
5.4.310.1570.04019.06
5.4.300.1230.04318.84
5.4.290.1500.03319.19
5.4.280.1530.03019.08
5.4.270.1670.03019.15
5.4.260.1670.03019.22
5.4.250.1600.03318.83
5.4.240.1670.02319.09
5.4.230.1700.03319.13
5.4.220.0030.04318.86
5.4.210.0030.03719.30
5.4.200.0030.03718.88
5.4.190.0870.04018.94
5.4.180.1870.04319.13
5.4.170.1700.04319.16
5.4.160.1430.03319.20
5.4.150.2100.03319.11
5.4.140.1570.03716.34
5.4.130.1700.04016.52
5.4.120.1800.03016.45
5.4.110.1930.03716.27
5.4.100.1700.04316.51
5.4.90.1500.04016.30
5.4.80.1570.03316.44
5.4.70.1770.04016.27
5.4.60.0730.04016.23
5.4.50.0130.06016.51
5.4.40.0170.06316.16
5.4.30.0530.04316.48
5.4.20.1800.04016.54
5.4.10.1630.04016.34
5.4.00.1700.04015.83
5.3.290.1670.04714.69
5.3.280.1530.03714.76
5.3.270.1730.04314.63
5.3.260.1500.04014.52
5.3.250.1500.04314.77
5.3.240.1630.03014.62
5.3.230.1570.03314.53
5.3.220.0570.04314.49
5.3.210.0000.04714.48
5.3.200.0400.06714.59
5.3.190.1470.04314.50
5.3.180.1500.03714.51
5.3.170.1770.04014.57
5.3.160.1600.03314.73
5.3.150.1430.04014.64
5.3.140.1730.04314.80
5.3.130.1500.03714.49
5.3.120.1600.04314.68
5.3.110.1630.05314.71
5.3.100.1630.03714.11
5.3.90.1830.04314.27
5.3.80.1700.04714.18
5.3.70.1730.04313.95
5.3.60.1730.04013.93
5.3.50.1770.04314.06
5.3.40.1830.03313.96
5.3.30.1730.03313.85
5.3.20.1700.03713.64
5.3.10.1600.03713.68
5.3.00.1770.04313.74
5.2.170.1500.03011.08
5.2.160.1430.03011.30
5.2.150.1370.04311.08
5.2.140.1270.03011.25
5.2.130.1400.03311.09
5.2.120.1670.02711.19
5.2.110.1270.03011.00
5.2.100.1400.02711.08
5.2.90.1470.03311.11
5.2.80.1430.03311.32
5.2.70.1370.03011.07
5.2.60.1370.03311.07
5.2.50.1270.03010.95
5.2.40.1130.04011.07
5.2.30.1070.03710.95
5.2.20.1230.02010.93
5.2.10.1370.02310.87
5.2.00.1030.02710.86
5.1.60.1270.0239.89
5.1.50.0870.02010.08
5.1.40.0000.03010.06
5.1.30.0000.03310.57
5.1.20.0000.03010.31
5.1.10.0070.03710.00
5.1.00.0730.0279.97
5.0.50.0600.0208.53
5.0.40.0730.0278.42
5.0.30.0530.0278.46
5.0.20.0630.0238.13
5.0.10.0630.0308.31
5.0.00.0670.0378.32
4.4.90.0470.0177.66
4.4.80.0530.0107.66
4.4.70.0530.0207.66
4.4.60.0470.0177.66
4.4.50.0500.0177.66
4.4.40.0530.0277.66
4.4.30.0530.0207.66
4.4.20.0570.0207.66
4.4.10.0500.0137.66
4.4.00.0470.0277.66
4.3.110.0600.0177.66
4.3.100.0700.0207.66
4.3.90.0470.0177.66
4.3.80.0470.0277.66
4.3.70.0470.0177.66
4.3.60.0500.0137.66
4.3.50.0530.0237.66
4.3.40.0530.0237.66
4.3.30.0070.0137.66
4.3.20.0000.0137.66
4.3.10.0000.0177.66
4.3.00.0000.0137.66

preferences:
34.54 ms | 401 KiB | 5 Q