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 = floatval($time ?: microtime(true)); $this->name = trim($name); $this->hash = strval($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.0080.01216.46
7.4.00.0060.00615.79
7.3.130.0080.00816.39
7.3.120.0080.00815.57
7.3.110.0070.00815.66
7.3.100.0060.01015.75
7.3.90.0060.01115.72
7.3.80.0120.00315.66
7.3.70.0100.00515.61
7.3.60.0060.00715.69
7.3.50.0050.00815.57
7.3.40.0030.01015.75
7.3.30.0070.00815.68
7.3.20.0050.00917.51
7.3.10.0070.00817.56
7.3.00.0070.00717.60
7.2.260.0120.00616.79
7.2.250.0050.01316.06
7.2.240.0070.01216.04
7.2.230.0100.00715.81
7.2.220.0060.00615.83
7.2.210.0050.01215.91
7.2.200.0070.01015.94
7.2.190.0130.00215.93
7.2.180.0100.00515.99
7.2.170.0130.00315.87
7.2.160.0060.00916.63
7.2.150.0060.00918.48
7.2.140.0030.01318.36
7.2.130.0030.01218.53
7.2.120.0070.00718.61
7.2.110.0140.00318.43
7.2.100.0060.01218.70
7.2.90.0090.00618.69
7.2.80.0080.00618.54
7.2.70.0070.01418.45
7.2.60.0110.00618.56
7.2.50.0100.01018.47
7.2.40.0130.00318.49
7.2.30.0000.01518.46
7.2.20.0000.01218.46
7.2.10.0080.00618.43
7.2.00.0060.01019.03
7.1.330.0100.00616.49
7.1.320.0080.00716.71
7.1.310.0050.00716.50
7.1.300.0100.00316.65
7.1.290.0030.00916.62
7.1.280.0090.00716.51
7.1.270.0050.01016.45
7.1.260.0060.00916.53
7.1.250.0030.01017.32
7.1.240.0030.00617.47
7.1.230.0070.01117.27
7.1.220.0030.00917.36
7.1.210.0090.00917.42
7.1.200.0080.00817.43
7.1.190.0160.00017.40
7.1.180.0080.00817.36
7.1.170.0090.00617.25
7.1.160.0040.01117.19
7.1.150.0060.00917.25
7.1.140.0030.00617.35
7.1.130.0030.01017.38
7.1.120.0180.00017.34
7.1.110.0030.00917.34
7.1.100.0040.00717.39
7.1.90.0040.01117.40
7.1.80.0030.01417.46
7.1.70.0040.00617.13
7.1.60.0060.00817.26
7.1.50.0050.01317.28
7.1.40.0000.01317.33
7.1.30.0060.00617.52
7.1.20.0030.01017.32
7.1.10.0070.00317.39
7.1.00.0030.02519.94
7.0.330.0030.00717.10
7.0.320.0000.01616.88
7.0.310.0080.00617.01
7.0.300.0060.00617.11
7.0.290.0060.00916.95
7.0.280.0110.00417.01
7.0.270.0070.01116.97
7.0.260.0060.00317.27
7.0.250.0030.00617.09
7.0.240.0090.00317.02
7.0.230.0040.01117.01
7.0.220.0000.01017.13
7.0.210.0000.01317.02
7.0.200.0100.00717.00
7.0.190.0030.00617.10
7.0.180.0070.00717.13
7.0.170.0030.00916.96
7.0.160.0000.01117.04
7.0.150.0120.00616.98
7.0.140.0050.04119.57
7.0.130.0030.00916.89
7.0.120.0000.01417.15
7.0.110.0060.00917.06
7.0.100.0100.00317.04
7.0.90.0060.00917.08
7.0.80.0070.01117.00
7.0.70.0090.00916.93
7.0.60.0100.02918.47
7.0.50.0080.02517.46
7.0.40.0050.04317.55
7.0.30.0100.04017.63
7.0.20.0140.02117.63
7.0.10.0160.02617.57
7.0.00.0100.04817.64
5.6.400.0040.01116.05
5.6.390.0030.00715.80
5.6.380.0090.00916.04
5.6.370.0060.00916.14
5.6.360.0060.01115.82
5.6.350.0090.00915.80
5.6.340.0040.01416.18
5.6.330.0070.00716.03
5.6.320.0060.01215.94
5.6.310.0060.00916.06
5.6.300.0160.00016.07
5.6.290.0030.01415.99
5.6.280.0030.04218.74
5.6.270.0060.00916.05
5.6.260.0100.00016.06
5.6.250.0000.01615.94
5.6.240.0060.00916.00
5.6.230.0070.01015.96
5.6.220.0130.00316.02
5.6.210.0070.04218.26
5.6.200.0100.03817.10
5.6.190.0050.02518.24
5.6.180.0150.04418.30
5.6.170.0280.02018.33
5.6.160.0150.03718.29
5.6.150.0080.02517.12
5.6.140.0050.03117.01
5.6.130.0110.04316.98
5.6.120.0080.04018.63
5.6.110.0050.04918.55
5.6.100.0070.02318.55
5.6.90.0060.04618.55
5.6.80.0070.04418.09
5.6.70.0150.03818.11
5.6.60.0060.00616.07
5.6.50.0070.01115.90
5.6.40.0030.01315.97
5.6.30.0060.01015.91
5.6.20.0030.00716.03
5.6.10.0000.01515.76
5.6.00.0000.00915.91
5.5.380.0100.00615.96
5.5.370.0110.00715.92
5.5.360.0080.00416.19
5.5.350.0020.02518.25
5.5.340.0110.04317.17
5.5.330.0090.04418.24
5.5.320.0150.04318.17
5.5.310.0150.03218.02
5.5.300.0140.02817.01
5.5.290.0090.03517.05
5.5.280.0080.03718.44
5.5.270.0020.02618.23
5.5.260.0140.04218.50
5.5.250.0050.04818.33
5.5.240.0070.03918.05
5.5.230.0090.00615.97
5.5.220.0150.00415.91
5.5.210.0090.00615.94
5.5.200.0060.00915.86
5.5.190.0060.01116.08
5.5.180.0090.00915.92
5.5.170.0120.00315.81
5.5.160.0100.00715.89
5.5.150.0000.01515.76
5.5.140.0070.00715.76
5.5.130.0110.00015.82
5.5.120.0070.01015.67
5.5.110.0030.01316.15
5.5.100.0030.01415.97
5.5.90.0040.01515.66
5.5.80.0100.00016.09
5.5.70.0100.01315.99
5.5.60.0140.00316.00
5.5.50.0090.01316.05
5.5.40.0130.00615.82
5.5.30.0090.01215.88
5.5.20.0100.00615.86
5.5.10.0080.01515.83
5.5.00.0050.01515.84
5.4.450.0380.03816.24
5.4.440.0570.03316.12
5.4.430.0430.03316.12
5.4.420.0520.03316.11
5.4.410.0430.03016.13
5.4.400.0220.02815.67
5.4.390.0250.02515.70
5.4.380.0100.03315.74
5.4.370.0080.03015.60
5.4.360.0050.03315.77
5.4.350.0060.01912.28
5.4.340.0080.02312.30
5.4.330.0080.00312.64
5.4.320.0050.02312.50
5.4.310.0060.02112.56
5.4.300.0080.02212.65
5.4.290.0070.02312.63
5.4.280.0060.02312.56
5.4.270.0090.02312.54
5.4.260.0060.02512.64
5.4.250.0050.03015.66
5.4.240.0120.02515.76
5.4.230.0090.02915.75
5.4.220.0050.03115.82
5.4.210.0070.03015.72
5.4.200.0080.02815.78
5.4.190.0060.03015.73
5.4.180.0070.03115.80
5.4.170.0100.03015.80
5.4.160.0040.03415.80
5.4.150.0040.02815.75
5.4.140.0040.03214.78
5.4.130.0040.03014.54
5.4.120.0110.02214.58
5.4.110.0050.03014.77
5.4.100.0030.02914.57
5.4.90.0060.02814.46
5.4.80.0100.02514.56
5.4.70.0030.03114.72
5.4.60.0070.03714.65
5.4.50.0100.02314.72
5.4.40.0080.02614.59
5.4.30.0050.02814.52
5.4.20.0050.02814.53
5.4.10.0020.03314.60
5.4.00.0030.03214.30
5.3.290.0060.02612.81
5.3.280.0080.02713.72
5.3.270.0030.03213.82
5.3.260.0040.03013.77
5.3.250.0050.03113.68
5.3.240.0050.02813.66
5.3.230.0070.02713.79
5.3.220.0030.03013.63
5.3.210.0120.02413.67
5.3.200.0000.03413.65
5.3.190.0030.03113.62
5.3.180.0080.02613.66
5.3.170.0100.02513.91
5.3.160.0070.02513.77
5.3.150.0080.02813.79
5.3.140.0120.03213.75
5.3.130.0070.03213.69
5.3.120.0120.03313.74
5.3.110.0030.03413.66
5.3.100.0050.03213.54
5.3.90.0030.02813.49
5.3.80.0130.01813.39
5.3.70.0020.03013.54
5.3.60.0060.02713.33
5.3.50.0110.02113.34
5.3.40.0110.02913.46
5.3.30.0050.03313.21
5.3.20.0050.02913.20
5.3.10.0000.03113.18
5.3.00.0050.03113.12
5.2.170.0000.04311.11
5.2.160.0100.03311.21
5.2.150.0000.04310.97
5.2.140.0030.04011.21
5.2.130.0100.04311.19
5.2.120.0030.03711.17
5.2.110.0000.04711.18
5.2.100.0070.05311.09
5.2.90.0130.03711.10
5.2.80.0070.04011.27
5.2.70.0000.04711.27
5.2.60.0100.03311.13
5.2.50.0030.04011.10
5.2.40.0030.04311.16
5.2.30.0030.04711.05
5.2.20.0070.04011.03
5.2.10.0000.04310.93
5.2.00.0070.04310.89
5.1.60.0100.0279.92
5.1.50.0030.03310.07
5.1.40.0070.03010.04
5.1.30.0100.03010.41
5.1.20.0130.03710.54
5.1.10.0130.03010.16
5.1.00.0070.03310.06
5.0.50.0000.0338.59
5.0.40.0030.0338.50
5.0.30.0000.0438.29
5.0.20.0030.0278.25
5.0.10.0070.0278.36
5.0.00.0030.0408.15
4.4.90.0070.0207.33
4.4.80.0000.0337.33
4.4.70.0030.0207.33
4.4.60.0000.0237.33
4.4.50.0100.0137.33
4.4.40.0070.0337.33
4.4.30.0100.0207.33
4.4.20.0030.0307.33
4.4.10.0030.0207.33
4.4.00.0070.0277.33
4.3.110.0030.0207.33
4.3.100.0000.0237.33
4.3.90.0070.0177.33
4.3.80.0070.0307.33
4.3.70.0100.0137.33
4.3.60.0030.0177.33
4.3.50.0100.0207.33
4.3.40.0100.0277.33
4.3.30.0030.0207.33
4.3.20.0000.0237.33
4.3.10.0000.0237.33
4.3.00.0070.0275.82

preferences:
36.61 ms | 401 KiB | 5 Q