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); 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.4.00.0100.01014.79
7.3.120.0060.01015.02
7.3.110.0090.00314.72
7.3.100.0030.01214.98
7.3.90.0030.01215.11
7.3.80.0080.00815.12
7.3.70.0090.00615.13
7.3.60.0030.01014.56
7.3.50.0060.00614.92
7.3.40.0030.00914.67
7.3.30.0090.00615.05
7.3.20.0050.00516.82
7.3.10.0090.00616.61
7.3.00.0090.00616.51
7.2.250.0160.00315.28
7.2.240.0070.01215.23
7.2.230.0110.00415.15
7.2.220.0040.00715.03
7.2.210.0080.00315.26
7.2.200.0060.00815.21
7.2.190.0030.01314.85
7.2.180.0070.00415.28
7.2.170.0030.01415.11
7.2.00.0040.01119.41
7.1.330.0030.01515.80
7.1.320.0080.00815.55
7.1.310.0060.00616.00
7.1.300.0030.00715.56
7.1.290.0000.01515.49
7.1.280.0070.00715.78
7.1.270.0070.00715.82
7.1.260.0050.00515.83
7.1.70.0060.00317.16
7.1.60.0070.01719.43
7.1.50.0060.01616.86
7.1.00.0070.03022.45
7.0.200.0040.00416.55
7.0.140.0070.07021.91
7.0.60.0100.08319.95
7.0.50.0100.05017.88
7.0.40.0070.04320.23
7.0.30.0230.08320.16
7.0.20.0130.04320.15
7.0.10.0200.05020.12
7.0.00.0100.07320.32
5.6.280.0100.06721.05
5.6.210.0130.07720.72
5.6.200.0070.07018.16
5.6.190.0000.04720.40
5.6.180.0270.04020.33
5.6.170.0430.07020.47
5.6.160.0100.08020.54
5.6.150.0000.04318.18
5.6.140.0100.04718.27
5.6.130.0130.07018.21
5.6.120.0130.07721.04
5.6.110.0100.08721.00
5.6.100.0170.03321.10
5.6.90.0130.08721.04
5.6.80.0170.07320.30
5.6.70.0270.07020.38
5.5.350.0030.04020.46
5.5.340.0100.07717.95
5.5.330.0030.07720.30
5.5.320.0270.07720.24
5.5.310.0230.04020.26
5.5.300.0000.08718.04
5.5.290.0070.08018.01
5.5.280.0130.07720.70
5.5.270.0070.03720.66
5.5.260.0230.06320.80
5.5.250.0100.08320.71
5.5.240.0070.08320.18
5.4.450.0770.08019.70
5.4.440.0930.05019.45
5.4.430.1030.05019.54
5.4.420.1200.05719.61
5.4.410.1070.04719.27
5.4.400.0530.07318.52
5.4.390.0330.07018.59
5.4.380.0200.05718.54
5.4.370.0170.07018.52
5.4.360.0170.05018.80
5.4.350.0050.04012.04
5.4.340.0080.03412.04
5.4.320.0090.03712.51
5.4.310.0060.03812.51
5.4.300.0080.04012.52
5.4.290.0050.04012.51
5.4.280.0070.03712.41
5.4.270.0050.04212.41
5.4.260.0050.03912.41
5.4.250.0170.06018.94
5.4.240.0200.04018.89
5.4.230.0130.04719.06
5.4.220.0000.06319.11
5.4.210.0000.06018.95
5.4.200.0130.07018.96
5.4.190.0100.05018.99
5.4.180.0030.05718.93
5.4.170.0100.05018.79
5.4.160.0170.04318.93
5.4.150.0030.06018.83
5.4.140.0100.06016.43
5.4.130.0070.05016.38
5.4.120.0170.04716.45
5.4.110.0030.05316.54
5.4.100.0070.05016.48
5.4.90.0070.05016.36
5.4.80.0130.04016.54
5.4.70.0100.04716.35
5.4.60.0130.04316.45
5.4.50.0030.05016.38
5.4.40.0100.05016.51
5.4.30.0100.04716.62
5.4.20.0070.05016.31
5.4.10.0030.05716.59
5.4.00.0170.04715.93
5.3.290.0080.04312.80
5.3.280.0030.05314.78
5.3.270.0100.05014.62
5.3.260.0130.06714.59
5.3.250.0100.06314.62
5.3.240.0170.04014.59
5.3.230.0130.05714.78
5.3.220.0030.05714.49
5.3.210.0070.05314.67
5.3.200.0070.05014.64
5.3.190.0030.07314.80
5.3.180.0100.05314.74
5.3.170.0030.05314.71
5.3.160.0130.06314.76
5.3.150.0070.05014.60
5.3.140.0100.05014.41
5.3.130.0200.05714.70
5.3.120.0170.04314.54
5.3.110.0170.06014.64
5.3.100.0000.06314.14
5.3.90.0170.04713.87
5.3.80.0100.07014.13
5.3.70.0170.06014.02
5.3.60.0070.05013.85
5.3.50.0130.04314.05
5.3.40.0170.04714.04
5.3.30.0100.04313.99
5.3.20.0070.06313.88
5.3.10.0070.04713.57
5.3.00.0130.04713.63
5.2.170.0030.04711.23
5.2.160.0030.04311.23
5.2.150.0070.04311.36
5.2.140.0000.04711.14
5.2.130.0070.05311.09
5.2.120.0030.04011.32
5.2.110.0030.04011.00
5.2.100.0030.04011.07
5.2.90.0000.04311.07
5.2.80.0130.03311.09
5.2.70.0030.04311.17
5.2.60.0070.04011.03
5.2.50.0130.03311.10
5.2.40.0070.04011.08
5.2.30.0000.04310.97
5.2.20.0030.04011.11
5.2.10.0170.03310.76
5.2.00.0070.04010.82
5.1.60.0030.0439.92
5.1.50.0030.03710.04
5.1.40.0000.03710.08
5.1.30.0070.03310.54
5.1.20.0000.04010.43
5.1.10.0070.03310.05
5.1.00.0030.05310.32
5.0.50.0000.0338.64
5.0.40.0130.0278.25
5.0.30.0000.0578.37
5.0.20.0070.0238.35
5.0.10.0030.0278.23
5.0.00.0070.0378.10
4.4.90.0000.0237.28
4.4.80.0070.0177.28
4.4.70.0030.0237.28
4.4.60.0000.0237.28
4.4.50.0000.0237.28
4.4.40.0030.0377.28
4.4.30.0000.0237.28
4.4.20.0000.0237.28
4.4.10.0070.0307.28
4.4.00.0070.0307.28
4.3.110.0000.0337.28
4.3.100.0000.0307.28
4.3.90.0000.0237.28
4.3.80.0030.0307.28
4.3.70.0070.0177.28
4.3.60.0000.0207.28
4.3.50.0070.0177.28
4.3.40.0030.0437.28
4.3.30.0030.0207.28
4.3.20.0000.0307.28
4.3.10.0030.0207.28
4.3.00.0100.0235.83

preferences:
33.47 ms | 400 KiB | 5 Q