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 = (float) $parts[1]; $id->hash = $parts[2]; return $id; } public function name() { return $this->name; } public function time() { return $this->time; } public function __toString() { return implode('_', [$this->name, $this->time, $this->hash]); } } $one = new CommandId('foo'); $two = CommandId::fromString((string) $one); assert($one == $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.3.10.0020.01016.56
7.3.00.0090.00716.65
7.2.130.0130.00516.99
7.2.120.0040.00817.05
7.2.110.0050.01116.91
7.2.100.0080.00516.92
7.2.90.0050.00917.05
7.2.80.0070.01016.94
7.2.70.0090.00617.01
7.2.60.0150.00317.10
7.2.50.0050.01016.94
7.2.40.0110.00716.92
7.2.30.0070.00617.02
7.2.20.0050.00817.02
7.2.10.0080.01016.97
7.2.00.0080.00716.91
7.1.250.0080.00915.74
7.1.240.0000.01115.80
7.1.230.0060.00915.89
7.1.220.0070.00715.55
7.1.210.0030.01115.66
7.1.200.0120.00315.98
7.1.190.0100.00315.59
7.1.180.0070.00715.69
7.1.170.0030.01015.52
7.1.160.0070.00715.77
7.1.150.0040.00815.68
7.1.140.0030.01015.86
7.1.130.0080.00315.73
7.1.120.0090.00615.93
7.1.110.0040.01115.73
7.1.100.0030.00515.82
7.1.90.0110.00015.78
7.1.80.0060.00915.91
7.1.70.0030.00716.27
7.1.60.0080.00717.69
7.1.50.0070.01316.19
7.1.40.0030.00615.42
7.1.30.0000.01415.91
7.1.20.0040.00715.56
7.1.10.0100.00315.75
7.1.00.0030.04219.00
7.0.330.0040.00715.39
7.0.320.0080.00415.25
7.0.310.0030.00615.29
7.0.300.0030.01015.61
7.0.290.0060.00315.27
7.0.280.0080.00415.51
7.0.270.0070.00715.52
7.0.260.0040.01115.37
7.0.250.0080.00315.44
7.0.240.0060.00615.49
7.0.230.0030.01015.37
7.0.220.0040.00715.04
7.0.210.0040.01115.33
7.0.200.0110.00816.08
7.0.190.0000.01415.40
7.0.180.0030.00915.47
7.0.170.0030.00815.20
7.0.160.0140.00015.17
7.0.150.0060.00615.07
7.0.140.0030.04318.83
7.0.130.0100.00015.23
7.0.120.0070.01015.46
7.0.110.0050.00315.21
7.0.100.0040.03417.69
7.0.90.0050.04517.64
7.0.80.0100.04217.59
7.0.70.0010.04517.70
7.0.60.0040.05117.63
7.0.50.0080.04817.93
7.0.40.0090.04716.74
7.0.30.0070.03716.71
7.0.20.0050.04516.70
7.0.10.0050.04516.65
7.0.00.0070.02716.79
5.6.380.0040.00714.60
5.6.370.0120.00314.50
5.6.360.0000.00914.39
5.6.350.0090.00614.38
5.6.340.0070.00714.61
5.6.330.0110.00314.53
5.6.320.0050.00514.04
5.6.310.0030.01014.57
5.6.300.0040.00814.36
5.6.290.0040.00714.59
5.6.280.0060.04117.74
5.6.270.0040.01114.16
5.6.260.0030.01014.28
5.6.250.0100.04217.65
5.6.240.0070.04217.52
5.6.230.0030.04917.54
5.6.220.0090.04217.41
5.6.210.0110.03917.55
5.6.200.0030.04217.76
5.6.190.0080.03717.79
5.6.180.0080.03717.67
5.6.170.0070.04517.59
5.6.160.0070.02617.81
5.6.150.0080.05017.67
5.6.140.0070.03217.75
5.6.130.0050.04917.65
5.6.120.0040.03417.68
5.6.110.0120.04317.70
5.6.100.0030.04517.71
5.6.90.0050.04717.57
5.6.80.0100.03717.37
5.6.70.0060.04217.53
5.6.60.0100.04217.40
5.6.50.0070.04517.40
5.6.40.0100.02417.41
5.6.30.0090.03917.47
5.6.20.0090.03217.38
5.6.10.0070.04217.41
5.6.00.0070.04417.32
5.5.380.0090.03515.82
5.5.370.0080.04015.86
5.5.360.0040.02815.88
5.5.350.0050.04315.77
5.5.340.0070.04516.10
5.5.330.0120.04016.06
5.5.320.0070.04316.06
5.5.310.0120.03816.12
5.5.300.0030.04516.11
5.5.290.0080.04715.94
5.5.280.0100.02216.00
5.5.270.0030.03615.95
5.5.260.0020.03216.09
5.5.250.0000.04615.95
5.5.240.0030.04215.75
5.5.230.0080.04115.74
5.5.220.0100.02815.65
5.5.210.0100.03315.65
5.5.200.0130.03015.69
5.5.190.0070.03915.80
5.5.180.0060.04415.59
5.5.170.0060.00611.18
5.5.160.0070.04115.74
5.5.150.0120.03815.70
5.5.140.0080.04215.73
5.5.130.0050.04115.71
5.5.120.0080.03315.71
5.5.110.0050.04215.73
5.5.100.0080.03715.68
5.5.90.0070.04115.63
5.5.80.0050.04615.63
5.5.70.0110.03715.64
5.5.60.0100.02315.66
5.5.50.0030.03015.58
5.5.40.0130.03515.70
5.5.30.0090.03315.69
5.5.20.0030.04015.56
5.5.10.0070.04315.59
5.5.00.0080.04015.66
5.4.450.0070.04015.27
5.4.440.0100.03815.29
5.4.430.0030.04615.29
5.4.420.0020.04415.26
5.4.410.0030.05215.25
5.4.400.0070.04015.21
5.4.390.0030.03315.10
5.4.380.0080.04215.16
5.4.370.0070.03815.11
5.4.360.0070.04015.02
5.4.350.0100.03715.13
5.4.340.0050.04315.11
5.4.330.0000.01311.18
5.4.320.0080.03615.11
5.4.310.0030.04515.07
5.4.300.0120.03315.18
5.4.290.0040.04215.03
5.4.280.0070.03515.20
5.4.270.0030.03615.11
5.4.260.0050.04115.11
5.4.250.0020.04515.02
5.4.240.0070.03515.15
5.4.230.0060.03715.10
5.4.220.0040.04015.13
5.4.210.0040.04315.06
5.4.200.0080.03815.01
5.4.190.0050.02515.18
5.4.180.0020.04115.20
5.4.170.0050.03115.15
5.4.160.0050.03415.10
5.4.150.0050.02315.14
5.4.140.0100.03713.80
5.4.130.0030.04013.80
5.4.120.0020.03413.80
5.4.110.0030.04313.83
5.4.100.0050.04113.81
5.4.90.0040.04113.80
5.4.80.0030.03513.79
5.4.70.0040.04013.77
5.4.60.0070.03813.82
5.4.50.0050.02513.82
5.4.40.0100.02113.81
5.4.30.0100.03513.75
5.4.20.0040.02913.81
5.4.10.0080.02413.84
5.4.00.0050.04013.45
5.3.290.0070.04212.89
5.3.280.0090.03812.85
5.3.270.0050.04012.93
5.3.260.0050.03112.86
5.3.250.0070.04212.89
5.3.240.0030.03212.95
5.3.230.0060.04012.95
5.3.220.0080.03712.89
5.3.210.0040.02512.84
5.3.200.0030.03912.88
5.3.190.0030.04512.93
5.3.180.0060.03612.87
5.3.170.0100.03512.92
5.3.160.0070.03712.91
5.3.150.0050.03912.87
5.3.140.0070.03412.90
5.3.130.0120.03312.90
5.3.120.0050.03812.90
5.3.110.0060.04612.92
5.3.100.0070.03212.60
5.3.90.0030.03812.62
5.3.80.0050.04012.63
5.3.70.0080.03912.67
5.3.60.0050.02512.54
5.3.50.0050.04012.57
5.3.40.0090.03612.56
5.3.30.0080.03512.55
5.3.20.0030.04012.49
5.3.10.0040.02012.43
5.3.00.0070.03712.48
5.2.170.0000.03911.38
5.2.160.0030.03111.38
5.2.150.0080.03011.38
5.2.140.0060.02911.38
5.2.130.0060.03011.38
5.2.120.0050.01811.38
5.2.110.0050.02811.38
5.2.100.0060.02811.38
5.2.90.0040.03511.38
5.2.80.0050.03511.38
5.2.70.0060.03011.38
5.2.60.0030.03611.38
5.2.50.0060.03011.38
5.2.40.0030.02511.38
5.2.30.0050.03311.38
5.2.20.0020.03211.38
5.2.10.0020.03311.38
5.2.00.0080.02511.38
5.1.60.0030.02711.38
5.1.50.0030.02811.38
5.1.40.0070.02211.38
5.1.30.0050.02911.38
5.1.20.0020.01511.38
5.1.10.0010.02011.38
5.1.00.0070.02511.38
5.0.50.0070.02511.38
5.0.40.0020.02411.38
5.0.30.0030.03111.38
5.0.20.0020.02411.38
5.0.10.0020.02311.38
5.0.00.0040.03311.38
4.4.90.0050.01611.38
4.4.80.0030.01711.38
4.4.70.0000.01511.38
4.4.60.0060.01511.38
4.4.50.0020.02011.38
4.4.40.0020.02911.38
4.4.30.0000.01511.38
4.4.20.0000.02211.38
4.4.10.0030.01511.38
4.4.00.0030.02511.38
4.3.110.0030.01811.38
4.3.100.0020.01111.38
4.3.90.0050.01511.38
4.3.80.0050.02311.38
4.3.70.0030.01711.38
4.3.60.0020.02011.38
4.3.50.0050.01611.38
4.3.40.0010.01811.38
4.3.30.0000.01711.38
4.3.20.0000.02111.38
4.3.10.0020.01711.38
4.3.00.0030.01711.38

preferences:
37.59 ms | 400 KiB | 5 Q