3v4l.org

run code in 300+ PHP versions simultaneously
<?php final class CommandId { private $name; private $time; private $hash; public function __construct($name) { $this->time = microtime(true); $this->name = trim($name); $this->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]"); } $id = new static($parts[0]); $id->time = floatval($parts[1]); $id->hash = $parts[2]; return $id; } public function name() { return $this->name; } public function time() { return $this->time; } public function equals(self $other) { return ($this == $other); } 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.0100.01014.90
7.4.00.0120.00815.10
7.3.130.0090.00614.85
7.3.120.0040.01514.95
7.3.110.0030.01414.60
7.3.100.0120.00314.63
7.3.90.0100.01014.68
7.3.80.0060.00614.66
7.3.70.0110.00414.59
7.3.60.0040.00414.82
7.3.50.0080.00314.86
7.3.40.0070.01114.88
7.3.30.0030.01515.09
7.3.20.0090.00316.79
7.3.10.0090.00616.84
7.3.00.0060.00916.80
7.2.260.0130.00615.02
7.2.250.0120.00615.06
7.2.240.0030.01315.39
7.2.230.0080.00814.95
7.2.220.0030.00915.29
7.2.210.0000.01615.12
7.2.200.0070.00715.26
7.2.190.0070.01115.23
7.2.180.0040.01115.15
7.2.170.0000.01015.09
7.2.160.0000.01415.11
7.2.150.0090.00016.77
7.2.140.0070.00317.03
7.2.130.0060.00917.22
7.2.120.0100.00617.08
7.2.110.0070.01017.12
7.2.100.0080.00416.93
7.2.90.0030.01217.00
7.2.80.0040.01216.91
7.2.70.0040.00716.86
7.2.60.0130.00316.95
7.2.50.0040.01417.01
7.2.40.0060.00916.84
7.2.30.0140.00317.02
7.2.20.0080.00417.11
7.2.10.0070.01316.78
7.2.00.0050.00918.16
7.1.330.0070.00715.86
7.1.320.0030.01215.63
7.1.310.0000.01415.93
7.1.300.0060.00915.89
7.1.290.0030.01015.70
7.1.280.0130.00315.49
7.1.270.0000.01415.96
7.1.260.0030.01315.76
7.1.250.0040.00715.87
7.1.240.0000.01716.00
7.1.230.0080.00415.79
7.1.220.0110.00415.56
7.1.210.0090.00615.86
7.1.200.0060.00915.92
7.1.190.0040.00815.59
7.1.180.0000.01015.86
7.1.170.0080.00815.58
7.1.160.0090.00615.91
7.1.150.0120.00315.84
7.1.140.0120.00315.87
7.1.130.0060.00915.50
7.1.120.0100.00315.90
7.1.110.0120.00015.90
7.1.100.0080.00615.50
7.1.90.0000.01415.94
7.1.80.0070.01015.78
7.1.70.0030.00716.41
7.1.60.0140.00517.85
7.1.50.0050.01216.20
7.1.40.0090.00615.52
7.1.30.0030.01315.55
7.1.20.0100.00715.84
7.1.10.0130.00715.93
7.1.00.0090.03819.13
7.0.330.0030.01015.43
7.0.320.0000.01615.15
7.0.310.0000.01315.43
7.0.300.0040.00815.63
7.0.290.0030.01315.40
7.0.280.0090.00615.32
7.0.270.0070.00715.41
7.0.260.0100.00315.48
7.0.250.0080.00815.54
7.0.240.0040.00815.39
7.0.230.0070.00715.50
7.0.220.0030.00615.39
7.0.210.0040.01115.57
7.0.200.0120.00315.99
7.0.190.0070.00715.54
7.0.180.0060.00615.60
7.0.170.0030.01015.22
7.0.160.0060.00615.62
7.0.150.0000.01515.43
7.0.140.0070.03718.77
7.0.130.0100.00715.58
7.0.120.0030.00915.14
7.0.110.0060.00315.52
7.0.100.0200.04517.74
7.0.90.0240.03617.87
7.0.80.0200.04517.86
7.0.70.0230.03817.75
7.0.60.0240.04017.81
7.0.50.0180.04517.84
7.0.40.0110.03616.80
7.0.30.0050.05116.86
7.0.20.0100.04516.79
7.0.10.0100.04216.64
7.0.00.0030.03216.68
5.6.400.0040.00814.27
5.6.390.0000.00914.52
5.6.380.0140.00014.61
5.6.370.0030.01014.69
5.6.360.0100.00714.31
5.6.350.0040.01414.71
5.6.340.0090.00614.56
5.6.330.0060.01014.62
5.6.320.0070.00414.55
5.6.310.0030.01014.62
5.6.300.0100.00614.37
5.6.290.0080.00814.78
5.6.280.0090.00614.19
5.6.270.0070.00714.31
5.6.260.0060.00314.42
5.6.250.0080.02017.53
5.6.240.0060.04317.62
5.6.230.0070.04717.47
5.6.220.0080.04517.58
5.6.210.0100.03817.58
5.6.200.0150.03717.84
5.6.190.0080.04517.63
5.6.180.0060.04517.72
5.6.170.0080.04517.91
5.6.160.0070.04217.73
5.6.150.0040.04617.64
5.6.140.0080.04517.71
5.6.130.0100.04617.68
5.6.120.0170.03817.70
5.6.110.0030.04717.94
5.6.100.0030.04017.78
5.6.90.0120.03317.74
5.6.80.0060.04317.42
5.6.70.0050.04517.55
5.6.60.0090.04017.47
5.6.50.0080.04217.33
5.6.40.0090.04017.31
5.6.30.0050.04517.47
5.6.20.0080.04317.34
5.6.10.0050.05017.41
5.6.00.0100.04117.39
5.5.380.0080.04017.34
5.5.370.0080.03317.53
5.5.360.0080.04417.26
5.5.350.0060.02617.48
5.5.340.0080.04117.62
5.5.330.0050.04717.55
5.5.320.0080.04017.73
5.5.310.0090.04217.65
5.5.300.0030.04817.45
5.5.290.0060.04417.76
5.5.280.0050.03217.74
5.5.270.0050.04817.61
5.5.260.0090.03817.66
5.5.250.0080.05017.48
5.5.240.0080.03317.20
5.5.230.0100.04017.16
5.5.220.0100.03817.31
5.5.210.0110.04217.42
5.5.200.0050.04617.39
5.5.190.0130.04017.21
5.5.180.0060.04117.19
5.5.170.0030.01314.47
5.5.160.0140.03817.35
5.5.150.0030.04617.33
5.5.140.0080.03617.25
5.5.130.0050.03817.35
5.5.120.0130.03117.23
5.5.110.0090.04017.39
5.5.100.0140.03817.20
5.5.90.0140.03717.18
5.5.80.0050.04217.26
5.5.70.0020.04417.10
5.5.60.0050.04017.22
5.5.50.0080.04417.22
5.5.40.0030.04517.30
5.5.30.0090.04017.03
5.5.20.0090.04317.11
5.5.10.0060.04117.04
5.5.00.0070.04517.19
5.4.450.0060.04316.09
5.4.440.0060.03616.21
5.4.430.0080.04216.26
5.4.420.0100.04016.09
5.4.410.0070.04016.01
5.4.400.0080.04016.05
5.4.390.0040.04416.01
5.4.380.0030.04415.96
5.4.370.0020.04716.10
5.4.360.0020.03916.09
5.4.350.0030.04116.00
5.4.340.0050.02816.00
5.4.330.0030.00312.96
5.4.320.0120.03716.05
5.4.310.0080.03316.09
5.4.300.0050.04316.07
5.4.290.0040.03715.96
5.4.280.0070.03016.09
5.4.270.0050.04016.10
5.4.260.0070.03615.93
5.4.250.0070.04416.00
5.4.240.0050.03815.93
5.4.230.0110.03515.92
5.4.220.0080.04216.05
5.4.210.0110.04015.90
5.4.200.0060.03516.05
5.4.190.0020.04115.93
5.4.180.0040.04315.92
5.4.170.0100.03716.07
5.4.160.0100.03815.99
5.4.150.0070.03016.05
5.4.140.0070.03814.71
5.4.130.0020.03814.69
5.4.120.0070.03814.66
5.4.110.0020.03914.66
5.4.100.0080.03814.70
5.4.90.0070.03914.66
5.4.80.0080.03714.73
5.4.70.0110.03114.64
5.4.60.0060.03814.73
5.4.50.0030.04314.64
5.4.40.0070.02814.69
5.4.30.0000.04614.63
5.4.20.0190.02514.72
5.4.10.0050.04014.72
5.4.00.0050.03514.42
5.3.290.0070.04113.87
5.3.280.0030.04613.82
5.3.270.0080.03813.77
5.3.260.0160.03113.84
5.3.250.0110.03313.78
5.3.240.0100.03813.84
5.3.230.0070.03813.82
5.3.220.0050.04113.75
5.3.210.0030.04513.77
5.3.200.0080.03613.77
5.3.190.0040.03913.78
5.3.180.0080.03813.74
5.3.170.0030.04213.74
5.3.160.0100.02913.79
5.3.150.0000.04613.78
5.3.140.0070.03813.76
5.3.130.0030.04413.81
5.3.120.0090.04013.80
5.3.110.0120.03513.81
5.3.100.0050.04213.50
5.3.90.0080.03813.57
5.3.80.0040.02913.45
5.3.70.0070.01913.53
5.3.60.0050.02713.56
5.3.50.0020.03313.47
5.3.40.0020.02413.46
5.3.30.0020.02213.41
5.3.20.0020.02413.33
5.3.10.0090.01913.38
5.3.00.0020.02213.30
5.2.170.0000.04311.24
5.2.160.0070.03011.03
5.2.150.0070.03011.25
5.2.140.0030.03011.16
5.2.130.0030.03011.14
5.2.120.0070.02711.16
5.2.110.0030.05011.04
5.2.100.0000.03011.20
5.2.90.0030.02711.03
5.2.80.0100.03011.16
5.2.70.0030.04011.00
5.2.60.0000.03011.14
5.2.50.0070.05310.96
5.2.40.0000.05310.91
5.2.30.0000.05010.96
5.2.20.0000.06011.09
5.2.10.0000.03710.89
5.2.00.0000.03710.79
5.1.60.0030.02310.07
5.1.50.0030.05310.00
5.1.40.0000.0339.84
5.1.30.0030.03710.27
5.1.20.0030.02310.28
5.1.10.0000.02710.17
5.1.00.0070.03310.07
5.0.50.0000.0208.87
5.0.40.0100.0108.87
5.0.30.0070.0308.87
5.0.20.0070.0238.87
5.0.10.0000.0278.87
5.0.00.0030.0438.87
4.4.90.0000.0178.87
4.4.80.0030.0138.87
4.4.70.0000.0178.87
4.4.60.0000.0178.87
4.4.50.0030.0138.87
4.4.40.0000.0278.87
4.4.30.0000.0178.87
4.4.20.0000.0178.87
4.4.10.0030.0138.87
4.4.00.0000.0238.87
4.3.110.0030.0138.87
4.3.100.0000.0178.87
4.3.90.0000.0338.87
4.3.80.0000.0278.87
4.3.70.0000.0278.87
4.3.60.0000.0308.87
4.3.50.0000.0208.87
4.3.40.0000.0338.87
4.3.30.0000.0208.87
4.3.20.0000.0138.87
4.3.10.0000.0178.87
4.3.00.0000.0138.87

preferences:
36.12 ms | 401 KiB | 5 Q