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 = (string) ($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.0130.00916.60
7.3.00.0160.00116.50
7.2.130.0130.01216.85
7.2.120.0100.01016.45
7.2.110.0110.01116.86
7.2.100.0070.01016.70
7.2.90.0120.00816.98
7.2.80.0160.00416.67
7.2.70.0100.00916.83
7.2.60.0110.01316.93
7.2.50.0140.00816.70
7.2.40.0080.01416.62
7.2.30.0140.00916.67
7.2.20.0100.01016.78
7.2.10.0140.00616.80
7.2.00.0090.00717.75
7.1.250.0140.00715.89
7.1.70.0000.00917.25
7.1.60.0070.01719.40
7.1.50.0000.01117.14
7.1.00.0000.08022.54
7.0.200.0690.00314.84
7.0.140.0070.07022.18
7.0.120.0000.04021.96
7.0.60.0130.07719.93
7.0.50.0130.07717.89
7.0.40.0070.04320.24
7.0.30.0200.07320.33
7.0.20.0170.05320.16
7.0.10.0200.08320.24
7.0.00.0030.08720.34
5.6.280.0070.07021.16
5.6.210.0030.06720.47
5.6.200.0130.07318.21
5.6.190.0100.07020.61
5.6.180.0270.04720.66
5.6.170.0300.08020.48
5.6.160.0100.08020.48
5.6.150.0070.03718.22
5.6.140.0070.06018.15
5.6.130.0130.07018.18
5.6.120.0000.04720.98
5.6.110.0100.03320.99
5.6.100.0070.04020.99
5.6.90.0030.05321.14
5.6.80.0070.08320.30
5.6.70.0330.05720.41
5.5.350.0300.07320.34
5.5.340.0070.04317.99
5.5.330.0030.05320.19
5.5.320.0170.08720.31
5.5.310.0270.04020.23
5.5.300.0130.04717.95
5.5.290.0100.05017.95
5.5.280.0070.04020.66
5.5.270.0030.08720.89
5.5.260.0130.07720.97
5.5.250.0030.07720.70
5.5.240.0070.04020.17
5.4.450.0000.05719.64
5.4.440.0070.08019.52
5.4.430.0000.07019.63
5.4.420.0070.07719.54
5.4.410.0000.08019.50
5.4.400.0100.06319.27
5.4.390.0030.07718.85
5.4.380.0030.07718.85
5.4.370.0030.08019.14
5.4.360.0030.07019.22
5.4.350.0000.05719.18
5.4.340.0070.08018.98
5.4.320.0100.07318.95
5.4.310.0030.05719.20
5.4.300.0030.07319.16
5.4.290.0000.07718.85
5.4.280.0100.07019.31
5.4.270.0030.04719.15
5.4.260.0130.07019.22
5.4.250.0030.07718.98
5.4.240.0070.07318.86
5.4.230.0000.08019.21
5.4.220.0000.07719.08
5.4.210.0030.07018.98
5.4.200.0070.05019.06
5.4.190.0070.04319.23
5.4.180.0070.06319.05
5.4.170.0030.06319.23
5.4.160.0030.06318.95
5.4.150.0070.07719.03
5.4.140.0030.07316.51
5.4.130.0030.05716.39
5.4.120.0100.05316.33
5.4.110.0030.07716.51
5.4.100.0030.07016.57
5.4.90.0030.07316.45
5.4.80.0000.07316.53
5.4.70.0000.06016.55
5.4.60.0030.04716.32
5.4.50.0000.06016.48
5.4.40.0000.08016.43
5.4.30.0000.07016.17
5.4.20.0100.06016.55
5.4.10.0000.07316.55
5.4.00.0000.07715.81
5.3.290.0030.08014.80
5.3.280.0030.08014.59
5.3.270.0070.07314.85
5.3.260.0030.05014.59
5.3.250.0200.05714.54
5.3.240.0000.08014.60
5.3.230.0070.06014.70
5.3.220.0030.07714.51
5.3.210.0070.07014.51
5.3.200.0100.04314.56
5.3.190.0100.06314.56
5.3.180.0070.07714.66
5.3.170.0000.08014.55
5.3.160.0000.05314.55
5.3.150.0030.05314.48
5.3.140.0030.05314.55
5.3.130.0030.08014.57
5.3.120.0000.07314.64
5.3.110.0070.07014.46
5.3.100.0070.05714.08
5.3.90.0030.06714.02
5.3.80.0030.06014.15
5.3.70.0030.07313.95
5.3.60.0030.07013.92
5.3.50.0000.04714.07
5.3.40.0100.06713.94
5.3.30.0000.07713.82
5.3.20.0100.06713.61
5.3.10.0000.06713.75
5.3.00.0000.08013.73
5.2.170.0000.06312.28
5.2.160.0030.05012.28
5.2.150.0030.06312.28
5.2.140.0000.06012.28
5.2.130.0070.06012.28
5.2.120.0070.05312.28
5.2.110.0030.04712.28
5.2.100.0070.04012.28
5.2.90.0000.06312.28
5.2.80.0000.04712.28
5.2.70.0030.04312.28
5.2.60.0130.04012.28
5.2.50.0000.06712.28
5.2.40.0030.04012.28
5.2.30.0030.05712.28
5.2.20.0070.03712.28
5.2.10.0070.05012.28
5.2.00.0000.06012.28
5.1.60.0030.05012.28
5.1.50.0070.05312.28
5.1.40.0000.05712.28
5.1.30.0070.05312.28
5.1.20.0070.04712.28
5.1.10.0130.04712.28
5.1.00.0070.04312.28
5.0.50.0000.03712.28
5.0.40.0030.04312.28
5.0.30.0030.05712.28
5.0.20.0000.04712.28
5.0.10.0070.02312.28
5.0.00.0030.02712.28
4.4.90.0000.03712.28
4.4.80.0000.03012.28
4.4.70.0000.02712.28
4.4.60.0000.04012.28
4.4.50.0000.03712.28
4.4.40.0030.05312.28
4.4.30.0030.02012.28
4.4.20.0000.03312.28
4.4.10.0030.03712.28
4.4.00.0100.04012.28
4.3.110.0070.03012.28
4.3.100.0030.02712.28
4.3.90.0000.01712.28
4.3.80.0030.02012.28
4.3.70.0000.01312.28
4.3.60.0000.01312.28
4.3.50.0000.01712.28
4.3.40.0030.04712.28
4.3.30.0030.01712.28
4.3.20.0030.01312.28
4.3.10.0000.01712.28
4.3.00.0000.01312.28

preferences:
38.5 ms | 401 KiB | 5 Q