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'); var_dump((string) $one, $one->equals(CommandId::fromString((string) $one)));

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.0070.01015.11
7.4.00.0080.00814.96
7.3.130.0070.01015.17
7.3.120.0090.00715.03
7.3.110.0060.01114.99
7.3.100.0060.01014.98
7.3.90.0080.00414.92
7.3.80.0100.00415.00
7.3.70.0050.01014.95
7.3.60.0030.01014.72
7.3.50.0040.01114.86
7.3.40.0060.00814.83
7.3.30.0040.00814.88
7.3.20.0080.00816.67
7.3.10.0050.00816.64
7.3.00.0050.00916.73
7.2.260.0070.01015.37
7.2.250.0070.01115.30
7.2.240.0050.01315.21
7.2.230.0060.00815.33
7.2.220.0020.01015.03
7.2.210.0010.01415.12
7.2.200.0050.00915.06
7.2.190.0030.01215.04
7.2.180.0030.01215.15
7.2.170.0040.00815.04
7.2.160.0130.00315.06
7.2.150.0000.01417.17
7.2.140.0040.00816.74
7.2.130.0130.00317.00
7.2.120.0050.00817.00
7.2.110.0080.00816.80
7.2.100.0120.00316.98
7.2.90.0070.00617.00
7.2.80.0060.00817.07
7.2.70.0050.00917.08
7.2.60.0070.00917.08
7.2.50.0070.00717.08
7.2.40.0100.00417.00
7.2.30.0070.00616.93
7.2.20.0050.00917.04
7.2.10.0070.00717.10
7.2.00.0050.00917.78
7.1.330.0060.00815.76
7.1.320.0030.00915.80
7.1.310.0040.00915.70
7.1.300.0120.00315.71
7.1.290.0080.00715.71
7.1.280.0080.00615.96
7.1.270.0050.00915.85
7.1.260.0060.01015.69
7.1.250.0060.00715.86
7.1.240.0050.00815.69
7.1.230.0050.00915.65
7.1.220.0070.00715.77
7.1.210.0020.00915.62
7.1.200.0030.01015.82
7.1.190.0080.00515.82
7.1.180.0030.01215.84
7.1.170.0040.01015.88
7.1.160.0060.00715.79
7.1.150.0070.00815.84
7.1.140.0050.00915.82
7.1.130.0050.00415.93
7.1.120.0040.00815.82
7.1.110.0050.00615.74
7.1.100.0070.00915.76
7.1.90.0050.00615.79
7.1.80.0030.01115.62
7.1.70.0080.00716.35
7.1.60.0070.01217.07
7.1.50.0070.00716.17
7.1.40.0100.00615.69
7.1.30.0060.00915.74
7.1.20.0020.01115.92
7.1.10.0050.00815.81
7.1.00.0050.01517.90
7.0.330.0050.01115.45
7.0.320.0080.00615.42
7.0.310.0080.00615.49
7.0.300.0050.00715.41
7.0.290.0030.00815.30
7.0.280.0050.00515.41
7.0.270.0000.01115.46
7.0.260.0050.00815.35
7.0.250.0030.01115.41
7.0.240.0050.00915.28
7.0.230.0040.01115.18
7.0.220.0070.00715.38
7.0.210.0070.00715.32
7.0.200.0090.00715.80
7.0.190.0030.01015.38
7.0.180.0050.00615.37
7.0.170.0030.00815.47
7.0.160.0120.00315.56
7.0.150.0050.00715.38
7.0.140.0040.03117.51
7.0.130.0060.00915.46
7.0.120.0070.00515.58
7.0.110.0060.00715.52
7.0.100.0070.02117.01
7.0.90.0060.03116.94
7.0.80.0070.03016.82
7.0.70.0080.03116.86
7.0.60.0030.03616.86
7.0.50.0070.03317.20
7.0.40.0080.02915.76
7.0.30.0160.01715.69
7.0.20.0060.03515.66
7.0.10.0080.02815.63
7.0.00.0080.03015.61
5.6.400.0040.01114.68
5.6.390.0040.01214.45
5.6.380.0110.00014.32
5.6.370.0060.00914.38
5.6.360.0060.00514.75
5.6.350.0100.00714.43
5.6.340.0080.00514.46
5.6.330.0080.00714.50
5.6.320.0050.00714.47
5.6.310.0110.00314.46
5.6.300.0090.00414.59
5.6.290.0040.01114.38
5.6.280.0020.03316.60
5.6.270.0020.01014.43
5.6.260.0060.00914.51
5.6.250.0080.03116.55
5.6.240.0040.03516.49
5.6.230.0090.03116.42
5.6.220.0200.02116.52
5.6.210.0100.02916.59
5.6.200.0090.03216.71
5.6.190.0050.02716.61
5.6.180.0050.03216.59
5.6.170.0060.03016.57
5.6.160.0110.02816.59
5.6.150.0030.03616.61
5.6.140.0040.03416.72
5.6.130.0020.03916.63
5.6.120.0050.03216.77
5.6.110.0080.03016.76
5.6.100.0080.03116.60
5.6.90.0090.02816.72
5.6.80.0020.03116.31
5.6.70.0070.02716.32
5.6.60.0050.01916.32
5.6.50.0040.01916.38
5.6.40.0060.02416.41
5.6.30.0070.01616.51
5.6.20.0010.03216.41
5.6.10.0040.01816.43
5.6.00.0060.02216.41
5.5.380.0050.03315.40
5.5.370.0100.02815.49
5.5.360.0070.03115.28
5.5.350.0070.03315.44
5.5.340.0050.03315.48
5.5.330.0020.03515.53
5.5.320.0050.02915.47
5.5.310.0080.03215.72
5.5.300.0070.03215.54
5.5.290.0050.03415.61
5.5.280.0060.02415.52
5.5.270.0020.03215.51
5.5.260.0040.03215.56
5.5.250.0090.02915.27
5.5.240.0080.02915.13
5.5.230.0050.01715.18
5.5.220.0010.02215.31
5.5.210.0040.02015.11
5.5.200.0010.02215.14
5.5.190.0060.01715.09
5.5.180.0080.01415.05
5.5.170.0070.00512.77
5.5.160.0020.02015.19
5.5.150.0070.02015.18
5.5.140.0070.02615.28
5.5.130.0040.02015.31
5.5.120.0040.01915.16
5.5.110.0060.01715.38
5.5.100.0070.01715.25
5.5.90.0030.01815.32
5.5.80.0060.01815.22
5.5.70.0020.02315.04
5.5.60.0060.01715.29
5.5.50.0070.02415.06
5.5.40.0060.02815.20
5.5.30.0070.01715.16
5.5.20.0060.01515.20
5.5.10.0080.01515.21
5.5.00.0060.02315.02
5.4.450.0030.03313.89
5.4.440.0070.02713.98
5.4.430.0070.03013.88
5.4.420.0050.02913.93
5.4.410.0030.03113.94
5.4.400.0080.01613.87
5.4.390.0030.01613.69
5.4.380.0020.02013.79
5.4.370.0050.01613.76
5.4.360.0030.01813.69
5.4.350.0020.01913.87
5.4.340.0040.01613.62
5.4.330.0060.00511.29
5.4.320.0020.01813.86
5.4.310.0020.01813.70
5.4.300.0060.01513.78
5.4.290.0040.01813.75
5.4.280.0080.01913.78
5.4.270.0040.01713.83
5.4.260.0030.01713.75
5.4.250.0050.01513.61
5.4.240.0030.01813.79
5.4.230.0020.01913.76
5.4.220.0040.02113.88
5.4.210.0080.02613.82
5.4.200.0050.02113.84
5.4.190.0020.01813.78
5.4.180.0050.02413.85
5.4.170.0070.01613.55
5.4.160.0050.02013.68
5.4.150.0020.01613.71
5.4.140.0030.02512.78
5.4.130.0040.01712.92
5.4.120.0080.02512.76
5.4.110.0030.02912.89
5.4.100.0040.02912.87
5.4.90.0080.02812.87
5.4.80.0070.02312.78
5.4.70.0020.03012.77
5.4.60.0070.02512.87
5.4.50.0090.02712.89
5.4.40.0070.02812.80
5.4.30.0020.02812.85
5.4.20.0080.02612.85
5.4.10.0030.03012.90
5.4.00.0040.02912.72
5.3.290.0020.03612.71
5.3.280.0000.02512.63
5.3.270.0020.02312.67
5.3.260.0030.02312.63
5.3.250.0070.02012.68
5.3.240.0000.03312.71
5.3.230.0040.04612.72
5.3.220.0050.03212.65
5.3.210.0090.03612.61
5.3.200.0070.03912.68
5.3.190.0050.04212.71
5.3.180.0100.03312.61
5.3.170.0040.03912.67
5.3.160.0020.02912.68
5.3.150.0120.03512.66
5.3.140.0020.04112.69
5.3.130.0080.04012.61
5.3.120.0020.04512.61
5.3.110.0030.04112.66
5.3.100.0020.03912.42
5.3.90.0030.03712.38
5.3.80.0020.04712.34
5.3.70.0070.04012.38
5.3.60.0070.03612.33
5.3.50.0040.03612.37
5.3.40.0050.04012.40
5.3.30.0030.02612.37
5.3.20.0030.04212.28
5.3.10.0050.03012.15
5.3.00.0030.03812.23
5.2.170.0070.03210.95
5.2.160.0090.02910.99
5.2.150.0030.02410.89
5.2.140.0050.02010.88
5.2.130.0080.03210.86
5.2.120.0070.03210.93
5.2.110.0050.03310.93
5.2.100.0050.03310.94
5.2.90.0080.02810.92
5.2.80.0070.03210.90
5.2.70.0040.03010.86
5.2.60.0020.03010.94
5.2.50.0060.03010.80
5.2.40.0030.03110.92
5.2.30.0070.03310.87
5.2.20.0050.03210.77
5.2.10.0030.03110.79
5.2.00.0030.03510.75
5.1.60.0030.02810.35
5.1.50.0070.02610.38
5.1.40.0040.02810.26
5.1.30.0030.02910.59
5.1.20.0060.02810.49
5.1.10.0050.02710.31
5.1.00.0030.02010.45
5.0.50.0030.0239.82
5.0.40.0040.0139.82
5.0.30.0000.0309.82
5.0.20.0040.0259.82
5.0.10.0000.0269.82
5.0.00.0050.0339.82
4.4.90.0030.0159.82
4.4.80.0030.0179.82
4.4.70.0030.0209.82
4.4.60.0030.0189.82
4.4.50.0030.0189.82
4.4.40.0030.0279.82
4.4.30.0030.0169.82
4.4.20.0020.0179.82
4.4.10.0030.0189.82
4.4.00.0020.0309.82
4.3.110.0020.0209.82
4.3.100.0030.0189.82
4.3.90.0030.0189.82
4.3.80.0050.0259.82
4.3.70.0030.0129.82
4.3.60.0020.0209.82
4.3.50.0000.0209.82
4.3.40.0020.0309.82
4.3.30.0000.0209.82
4.3.20.0050.0189.82
4.3.10.0020.0189.82
4.3.00.0010.0209.82

preferences:
35.13 ms | 401 KiB | 5 Q