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.4.10.0030.01314.98
7.4.00.0080.00915.21
7.3.130.0100.01014.73
7.3.120.0080.00714.90
7.3.110.0040.01415.05
7.3.100.0040.01415.05
7.3.90.0040.00814.97
7.3.80.0070.00614.90
7.3.70.0090.00514.94
7.3.60.0100.00514.78
7.3.50.0080.00314.85
7.3.40.0050.01114.97
7.3.30.0000.01114.82
7.3.20.0070.00816.53
7.3.10.0100.00916.55
7.3.00.0110.00716.67
7.2.260.0070.01115.13
7.2.250.0090.00915.15
7.2.240.0060.01115.06
7.2.230.0030.01114.97
7.2.220.0060.00715.31
7.2.210.0110.00515.15
7.2.200.0060.00815.14
7.2.190.0080.00614.93
7.2.180.0050.00915.17
7.2.170.0050.00915.03
7.2.160.0080.00815.28
7.2.150.0060.01216.93
7.2.140.0130.00317.13
7.2.130.0170.00516.97
7.2.120.0060.01116.89
7.2.110.0070.01016.87
7.2.100.0110.00616.80
7.2.90.0060.00816.84
7.2.80.0110.00517.01
7.2.70.0040.01016.86
7.2.60.0090.00916.81
7.2.50.0100.00916.96
7.2.40.0060.01016.92
7.2.30.0070.00816.79
7.2.20.0120.00516.65
7.2.10.0090.00716.84
7.2.00.0060.00816.84
7.1.330.0060.00915.80
7.1.320.0100.00515.98
7.1.310.0040.01115.92
7.1.300.0050.00815.88
7.1.290.0070.00715.71
7.1.280.0070.00815.88
7.1.270.0030.01215.78
7.1.260.0020.01315.71
7.1.250.0040.01215.84
7.1.240.0020.01315.90
7.1.230.0120.00715.79
7.1.220.0050.00515.73
7.1.210.0040.01015.56
7.1.200.0100.00715.66
7.1.190.0050.01015.81
7.1.180.0020.00815.76
7.1.170.0020.01315.82
7.1.160.0050.01115.81
7.1.150.0080.00415.85
7.1.140.0030.00815.80
7.1.130.0070.00715.87
7.1.120.0060.00615.74
7.1.110.0060.01015.77
7.1.100.0070.00815.88
7.1.90.0070.00715.77
7.1.80.0070.00915.76
7.1.70.0070.00416.26
7.1.60.0090.00817.13
7.1.50.0050.01016.17
7.1.40.0050.00715.85
7.1.30.0050.00815.84
7.1.20.0060.00615.67
7.1.10.0060.00715.81
7.1.00.0070.01818.04
7.0.330.0050.00715.40
7.0.320.0090.00515.56
7.0.310.0060.00715.42
7.0.300.0100.00715.42
7.0.290.0110.00715.34
7.0.280.0050.01015.40
7.0.270.0070.00715.52
7.0.260.0030.00715.31
7.0.250.0040.00915.39
7.0.240.0060.01015.38
7.0.230.0030.00915.38
7.0.220.0040.00715.40
7.0.210.0100.00315.29
7.0.200.0100.00515.87
7.0.190.0050.00715.41
7.0.180.0070.00815.34
7.0.170.0020.00815.33
7.0.160.0070.00315.42
7.0.150.0050.00915.43
7.0.140.0050.02817.73
7.0.130.0110.00315.47
7.0.120.0030.01115.51
7.0.110.0050.00815.29
7.0.100.0100.02816.98
7.0.90.0140.03416.87
7.0.80.0080.02817.04
7.0.70.0120.02916.99
7.0.60.0060.01816.88
7.0.50.0110.03417.05
7.0.40.0070.03315.63
7.0.30.0030.02915.65
7.0.20.0070.02115.58
7.0.10.0060.02015.67
7.0.00.0090.03115.53
5.6.400.0070.00714.44
5.6.390.0030.01214.59
5.6.380.0110.00314.23
5.6.370.0050.01314.67
5.6.360.0050.00914.49
5.6.350.0070.00914.45
5.6.340.0060.00814.48
5.6.330.0060.00814.63
5.6.320.0030.01014.77
5.6.310.0040.01014.47
5.6.300.0040.00614.71
5.6.290.0130.00514.29
5.6.280.0060.03016.66
5.6.270.0020.01314.45
5.6.260.0060.00814.40
5.6.250.0030.03716.56
5.6.240.0050.03416.54
5.6.230.0080.02916.51
5.6.220.0080.03116.60
5.6.210.0080.01916.48
5.6.200.0100.03016.61
5.6.190.0130.01816.64
5.6.180.0080.03116.60
5.6.170.0060.03216.42
5.6.160.0090.02916.70
5.6.150.0090.02816.68
5.6.140.0030.03516.76
5.6.130.0050.03416.67
5.6.120.0030.03516.49
5.6.110.0070.03616.66
5.6.100.0110.02916.58
5.6.90.0120.02716.62
5.6.80.0080.02916.37
5.6.70.0090.03116.42
5.6.60.0020.03016.34
5.6.50.0070.02816.37
5.6.40.0080.02616.39
5.6.30.0060.03116.33
5.6.20.0120.02316.29
5.6.10.0040.03316.36
5.6.00.0130.02716.34
5.5.380.0080.03215.31
5.5.370.0080.02515.42
5.5.360.0080.03115.35
5.5.350.0110.02915.25
5.5.340.0060.02915.39
5.5.330.0050.03415.49
5.5.320.0100.02115.38
5.5.310.0080.03215.49
5.5.300.0010.03515.52
5.5.290.0160.02515.42
5.5.280.0080.03115.41
5.5.270.0090.03115.46
5.5.260.0050.03215.49
5.5.250.0070.03115.42
5.5.240.0070.02915.24
5.5.230.0090.02615.30
5.5.220.0060.01915.39
5.5.210.0050.03215.29
5.5.200.0050.02715.31
5.5.190.0080.03315.39
5.5.180.0110.02915.11
5.5.170.0030.00912.75
5.5.160.0070.02015.14
5.5.150.0090.02015.29
5.5.140.0040.02615.33
5.5.130.0060.03115.27
5.5.120.0080.03115.02
5.5.110.0070.03115.11
5.5.100.0080.01815.23
5.5.90.0040.02714.96
5.5.80.0040.02615.14
5.5.70.0060.02915.15
5.5.60.0060.02115.28
5.5.50.0040.02815.35
5.5.40.0030.02115.11
5.5.30.0090.03015.36
5.5.20.0060.03115.20
5.5.10.0070.03015.31
5.5.00.0020.03414.98
5.4.450.0070.02714.56
5.4.440.0050.03514.61
5.4.430.0040.02614.45
5.4.420.0070.01714.59
5.4.410.0050.03014.58
5.4.400.0080.01414.46
5.4.390.0020.02614.43
5.4.380.0050.02714.43
5.4.370.0050.02914.39
5.4.360.0050.03414.48
5.4.350.0100.02614.45
5.4.340.0100.02814.27
5.4.330.0060.00712.13
5.4.320.0030.03314.28
5.4.310.0080.02714.46
5.4.300.0070.02714.28
5.4.290.0080.02614.38
5.4.280.0040.03014.22
5.4.270.0020.03314.31
5.4.260.0090.02514.32
5.4.250.0060.02114.38
5.4.240.0100.02014.30
5.4.230.0130.02114.37
5.4.220.0060.02814.38
5.4.210.0060.01814.38
5.4.200.0040.03014.48
5.4.190.0070.02414.36
5.4.180.0040.01814.29
5.4.170.0020.03114.32
5.4.160.0080.02014.41
5.4.150.0090.02614.35
5.4.140.0060.02913.46
5.4.130.0070.02613.49
5.4.120.0040.02813.52
5.4.110.0070.01813.50
5.4.100.0050.02613.45
5.4.90.0070.02813.50
5.4.80.0030.01713.53
5.4.70.0050.01613.52
5.4.60.0070.02313.49
5.4.50.0040.02013.48
5.4.40.0020.02913.55
5.4.30.0050.02313.43
5.4.20.0050.02413.46
5.4.10.0100.02313.52
5.4.00.0060.02513.24
5.3.290.0070.02512.71
5.3.280.0040.02112.62
5.3.270.0090.02712.70
5.3.260.0050.02812.67
5.3.250.0040.03012.64
5.3.240.0020.03012.58
5.3.230.0040.02812.70
5.3.220.0060.02712.70
5.3.210.0060.02812.63
5.3.200.0080.02812.61
5.3.190.0050.01612.65
5.3.180.0010.02512.60
5.3.170.0040.02812.73
5.3.160.0030.02912.68
5.3.150.0070.02412.63
5.3.140.0080.02512.72
5.3.130.0050.02712.73
5.3.120.0040.02512.66
5.3.110.0070.02512.64
5.3.100.0080.02612.53
5.3.90.0080.02112.52
5.3.80.0040.01312.43
5.3.70.0070.01912.47
5.3.60.0020.01912.49
5.3.50.0040.03012.46
5.3.40.0070.02412.42
5.3.30.0080.02612.43
5.3.20.0090.01912.39
5.3.10.0040.02912.25
5.3.00.0030.03012.32
5.2.170.0040.03310.12
5.2.160.0030.02510.36
5.2.150.0070.03010.28
5.2.140.0070.03010.11
5.2.130.0050.03210.23
5.2.120.0040.02710.29
5.2.110.0070.02510.16
5.2.100.0090.03010.16
5.2.90.0100.03210.12
5.2.80.0170.02310.02
5.2.70.0120.03210.07
5.2.60.0080.01810.21
5.2.50.0090.02910.17
5.2.40.0020.03210.20
5.2.30.0070.03510.12
5.2.20.0060.0319.97
5.2.10.0040.03410.01
5.2.00.0070.0309.90
5.1.60.0070.0289.20
5.1.50.0040.0309.21
5.1.40.0020.0329.21
5.1.30.0060.0269.48
5.1.20.0090.0289.38
5.1.10.0050.0339.20
5.1.00.0100.0279.23
5.0.50.0090.0238.59
5.0.40.0120.0088.59
5.0.30.0090.0318.59
5.0.20.0070.0158.59
5.0.10.0060.0228.59
5.0.00.0060.0328.59
4.4.90.0050.0188.59
4.4.80.0040.0198.59
4.4.70.0050.0208.59
4.4.60.0040.0208.59
4.4.50.0050.0138.59
4.4.40.0030.0258.59
4.4.30.0000.0198.59
4.4.20.0080.0138.59
4.4.10.0000.0138.59
4.4.00.0030.0308.59
4.3.110.0030.0228.59
4.3.100.0020.0208.59
4.3.90.0080.0138.59
4.3.80.0060.0248.59
4.3.70.0030.0188.59
4.3.60.0050.0188.59
4.3.50.0010.0138.59
4.3.40.0080.0258.59
4.3.30.0000.0178.59
4.3.20.0040.0208.59
4.3.10.0050.0128.59
4.3.00.0020.0208.59

preferences:
41.69 ms | 401 KiB | 5 Q