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', (string) 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 "{$this->name}_{$this->time}_{$this->hash}"; } } $one = new CommandId('foo'); $two = new CommandId('foo'); assert($one != $two); var_dump($one, $two, (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.4.10.0120.00614.92
7.4.00.0180.00015.02
7.3.130.0070.01114.76
7.3.120.0060.01214.84
7.3.110.0070.01414.71
7.3.100.0030.01314.83
7.3.90.0070.00715.08
7.3.80.0000.01415.10
7.3.70.0060.00814.89
7.3.60.0040.00914.47
7.3.50.0030.01414.69
7.3.40.0030.01014.91
7.3.30.0080.00615.00
7.3.20.0090.00316.52
7.3.10.0110.00716.70
7.3.00.0030.01316.73
7.2.260.0060.01315.25
7.2.250.0110.00715.30
7.2.240.0070.01015.39
7.2.230.0080.00815.25
7.2.220.0040.01115.04
7.2.210.0090.00615.17
7.2.200.0000.01214.88
7.2.190.0070.00715.05
7.2.180.0040.01115.07
7.2.170.0070.00715.18
7.2.160.0060.00315.39
7.2.150.0030.01717.20
7.2.140.0060.00916.53
7.2.130.0030.01017.06
7.2.120.0070.01017.19
7.2.110.0040.01116.85
7.2.100.0070.01117.12
7.2.90.0030.01316.86
7.2.80.0100.00017.04
7.2.70.0120.00317.20
7.2.60.0000.01416.82
7.2.50.0000.01417.01
7.2.40.0080.00517.18
7.2.30.0070.00716.89
7.2.20.0000.01416.96
7.2.10.0040.01216.96
7.2.00.0040.00918.00
7.1.330.0070.01015.58
7.1.320.0030.00915.71
7.1.310.0060.00315.84
7.1.300.0090.00615.57
7.1.290.0080.00415.49
7.1.280.0060.00615.61
7.1.270.0030.00615.83
7.1.260.0040.01115.46
7.1.250.0040.00815.84
7.1.240.0040.00815.73
7.1.230.0100.00015.61
7.1.220.0040.01415.62
7.1.210.0120.00315.84
7.1.200.0070.01015.77
7.1.190.0040.01115.88
7.1.180.0030.00715.75
7.1.170.0030.00915.79
7.1.160.0090.00615.52
7.1.150.0090.00615.90
7.1.140.0000.01115.50
7.1.130.0140.00015.88
7.1.120.0090.00415.39
7.1.110.0090.00615.63
7.1.100.0030.01015.59
7.1.90.0030.01315.95
7.1.80.0030.00615.95
7.1.70.0060.00816.14
7.1.60.0090.00817.66
7.1.50.0070.00716.23
7.1.40.0090.00615.66
7.1.30.0080.00815.79
7.1.20.0030.00915.86
7.1.10.0000.01415.71
7.1.00.0030.03819.05
7.0.330.0080.00315.48
7.0.320.0070.01015.07
7.0.310.0000.01415.41
7.0.300.0000.00915.39
7.0.290.0060.00915.14
7.0.280.0030.00915.46
7.0.270.0070.00715.38
7.0.260.0070.00715.23
7.0.250.0030.01415.63
7.0.240.0090.00615.55
7.0.230.0120.00315.39
7.0.220.0100.00315.57
7.0.210.0040.01215.42
7.0.200.0050.00815.80
7.0.190.0100.00315.32
7.0.180.0030.01315.25
7.0.170.0030.01315.25
7.0.160.0050.00315.41
7.0.150.0080.00815.56
7.0.140.0020.04218.73
7.0.130.0030.01215.51
7.0.120.0030.01015.10
7.0.110.0040.00415.52
7.0.100.0070.00715.23
7.0.90.0040.00415.21
7.0.80.0000.01215.58
7.0.70.0000.00815.38
7.0.60.0090.03717.48
7.0.50.0050.04516.69
7.0.40.0080.04016.82
7.0.30.0210.03816.80
7.0.20.0150.02916.92
7.0.10.0150.04316.87
7.0.00.0090.04316.64
5.6.400.0090.00614.45
5.6.390.0040.01214.51
5.6.380.0060.00314.04
5.6.370.0000.01714.40
5.6.360.0060.01014.27
5.6.350.0040.01114.21
5.6.340.0080.00414.64
5.6.330.0070.00714.27
5.6.320.0040.01114.26
5.6.310.0140.00314.04
5.6.300.0040.01114.50
5.6.290.0000.01414.61
5.6.280.0060.03717.65
5.6.270.0060.00614.52
5.6.260.0100.00314.68
5.6.250.0000.01614.26
5.6.240.0040.00814.37
5.6.230.0070.00414.22
5.6.220.0030.00614.43
5.6.210.0080.04317.47
5.6.200.0040.02516.33
5.6.190.0030.02917.50
5.6.180.0150.04217.41
5.6.170.0270.02717.41
5.6.160.0100.03717.40
5.6.150.0070.04316.34
5.6.140.0080.04116.20
5.6.130.0110.03316.29
5.6.120.0080.04417.62
5.6.110.0030.02317.63
5.6.100.0030.02617.58
5.6.90.0090.04217.62
5.6.80.0050.04717.31
5.6.70.0200.03717.42
5.6.60.0060.00914.30
5.6.50.0040.01114.38
5.6.40.0040.01214.32
5.6.30.0130.00314.19
5.6.20.0060.00814.39
5.6.10.0040.01114.41
5.6.00.0060.00614.14
5.5.380.0040.00914.32
5.5.370.0030.00714.02
5.5.360.0030.00614.15
5.5.350.0080.02317.27
5.5.340.0100.04016.03
5.5.330.0070.03017.21
5.5.320.0170.04217.36
5.5.310.0120.03417.25
5.5.300.0000.05216.06
5.5.290.0060.03815.93
5.5.280.0060.04817.53
5.5.270.0050.02617.44
5.5.260.0070.04117.48
5.5.250.0050.04517.50
5.5.240.0050.04417.20
5.5.230.0070.01014.19
5.5.220.0030.01013.81
5.5.210.0060.00914.20
5.5.200.0030.01014.26
5.5.190.0070.00714.32
5.5.180.0070.00714.46
5.5.170.0070.01014.10
5.5.160.0030.01414.35
5.5.150.0060.00914.34
5.5.140.0000.01114.19
5.5.130.0000.01313.83
5.5.120.0040.01114.25
5.5.110.0030.01014.04
5.5.100.0100.00714.14
5.5.90.0030.01013.94
5.5.80.0030.00613.77
5.5.70.0130.00013.97
5.5.60.0040.00814.26
5.5.50.0110.00014.39
5.5.40.0090.00613.97
5.5.30.0030.01314.02
5.5.20.0030.01213.96
5.5.10.0140.00313.65
5.5.00.0030.00614.03
5.4.450.0360.03315.27
5.4.440.0630.03815.38
5.4.430.0530.03615.39
5.4.420.0550.03115.42
5.4.410.0500.03915.21
5.4.400.0270.03814.71
5.4.390.0220.03014.89
5.4.380.0100.03214.88
5.4.370.0080.03014.86
5.4.360.0130.02614.81
5.4.350.0050.02211.59
5.4.340.0060.02511.59
5.4.330.0030.00910.90
5.4.320.0080.02211.72
5.4.310.0110.01911.64
5.4.300.0040.02511.77
5.4.290.0060.02311.62
5.4.280.0050.01811.73
5.4.270.0040.02611.86
5.4.260.0060.02111.61
5.4.250.0070.03214.89
5.4.240.0120.02914.81
5.4.230.0050.03315.02
5.4.220.0100.02714.92
5.4.210.0070.04214.87
5.4.200.0080.02814.91
5.4.190.0070.03314.86
5.4.180.0080.02714.96
5.4.170.0130.02314.92
5.4.160.0100.02215.05
5.4.150.0080.02814.94
5.4.140.0050.03013.82
5.4.130.0070.02713.56
5.4.120.0100.02513.66
5.4.110.0070.02813.70
5.4.100.0090.02413.88
5.4.90.0050.03913.69
5.4.80.0080.02513.78
5.4.70.0070.02713.73
5.4.60.0060.03613.77
5.4.50.0060.02613.80
5.4.40.0120.02513.86
5.4.30.0050.02813.77
5.4.20.0050.02713.71
5.4.10.0110.04013.80
5.4.00.0130.02513.41
5.3.290.0050.02111.83
5.3.280.0030.03112.69
5.3.270.0090.02512.71
5.3.260.0030.03112.62
5.3.250.0030.03012.67
5.3.240.0100.03512.62
5.3.230.0050.02812.74
5.3.220.0050.02912.60
5.3.210.0030.03112.49
5.3.200.0070.03012.55
5.3.190.0080.03512.49
5.3.180.0100.02212.71
5.3.170.0050.02712.59
5.3.160.0050.03012.55
5.3.150.0100.02412.71
5.3.140.0080.02312.60
5.3.130.0080.03712.65
5.3.120.0100.02612.60
5.3.110.0090.02512.66
5.3.100.0120.03312.26
5.3.90.0020.02912.41
5.3.80.0050.02812.24
5.3.70.0050.02712.24
5.3.60.0030.03012.32
5.3.50.0030.02812.15
5.3.40.0140.02512.30
5.3.30.0080.03512.33
5.3.20.0050.03012.16
5.3.10.0080.02311.90
5.3.00.0050.02811.83
5.2.170.0070.04011.05
5.2.160.0030.04011.16
5.2.150.0070.04311.33
5.2.140.0030.04311.15
5.2.130.0070.03711.09
5.2.120.0100.03311.18
5.2.110.0070.05711.13
5.2.100.0100.03711.07
5.2.90.0070.03711.09
5.2.80.0130.03311.05
5.2.70.0100.03711.05
5.2.60.0070.04011.24
5.2.50.0070.04011.03
5.2.40.0030.04011.23
5.2.30.0070.06010.95
5.2.20.0000.04310.96
5.2.10.0100.03310.84
5.2.00.0070.05710.71
5.1.60.0100.02710.46
5.1.50.0100.02710.46
5.1.40.0130.03010.46
5.1.30.0070.04010.46
5.1.20.0130.03010.52
5.1.10.0100.03010.46
5.1.00.0070.03310.46
5.0.50.0030.03010.46
5.0.40.0070.02310.46
5.0.30.0000.04710.46
5.0.20.0130.01710.46
5.0.10.0100.02310.46
5.0.00.0030.04310.46
4.4.90.0030.02010.46
4.4.80.0070.01710.46
4.4.70.0000.02310.46
4.4.60.0000.02310.46
4.4.50.0030.02010.46
4.4.40.0100.03010.46
4.4.30.0030.02010.46
4.4.20.0030.02010.46
4.4.10.0030.02010.46
4.4.00.0070.03010.46
4.3.110.0030.02310.46
4.3.100.0030.03010.46
4.3.90.0000.02310.46
4.3.80.0030.03310.46
4.3.70.0000.02310.46
4.3.60.0030.02010.46
4.3.50.0030.02010.46
4.3.40.0100.02310.46
4.3.30.0070.02310.46
4.3.20.0030.02010.46
4.3.10.0030.02010.46
4.3.00.0170.0205.82

preferences:
39.84 ms | 401 KiB | 5 Q