3v4l.org

run code in 300+ PHP versions simultaneously
<?php final class CommandId { private $name; private $time; public function __construct($name) { $this->time = microtime(true); $this->name = trim($name); if (empty($this->name)) { throw new DomainException('Name must not be empty'); } } public static function fromString($idString) { $parts = explode('_', $idString); if (count($parts) != 2) { throw new DomainException("Unexpected format [$idString]"); } $id = new static($parts[0]); $id->time = (float) $parts[1]; return $id; } public function name() { return $this->name; } public function time() { return $this->time; } public function __toString() { return "{$this->name}_{$this->time}"; } } $one = new CommandId('foo'); $two = new CommandId('foo'); assert($one != $two, 'one should not equal two'); var_dump($one, $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.00.0070.01015.04
7.3.120.0060.01014.82
7.3.110.0070.01014.86
7.3.100.0070.00714.92
7.3.90.0040.00414.96
7.3.80.0080.00814.94
7.3.70.0100.00314.96
7.3.60.0040.00714.78
7.3.50.0130.00314.64
7.3.40.0060.01014.76
7.3.30.0070.00714.79
7.3.20.0090.00616.78
7.3.10.0100.00716.72
7.3.00.0030.00716.58
7.2.250.0100.00715.09
7.2.240.0070.01115.10
7.2.230.0000.01315.13
7.2.220.0040.00714.84
7.2.210.0070.01115.02
7.2.200.0030.00914.85
7.2.190.0060.00614.96
7.2.180.0000.01514.89
7.2.170.0040.00815.01
7.2.00.0000.01219.32
7.1.330.0030.01015.98
7.1.320.0000.01315.95
7.1.310.0040.01215.60
7.1.300.0060.00315.59
7.1.290.0060.00915.76
7.1.280.0000.00815.89
7.1.270.0000.01415.54
7.1.260.0030.01015.72
7.1.70.0050.00217.24
7.1.60.0040.01819.43
7.1.50.0090.01516.91
7.1.00.0030.07022.33
7.0.200.0180.00616.61
7.0.140.0030.07722.09
7.0.60.0030.08319.80
7.0.50.0070.05017.89
7.0.40.0030.04320.27
7.0.30.0470.04020.24
7.0.20.0230.03320.06
7.0.10.0000.05020.23
7.0.00.0130.08320.05
5.6.280.0030.07321.07
5.6.210.0000.05320.63
5.6.200.0030.04018.20
5.6.190.0030.09320.41
5.6.180.0030.09020.55
5.6.170.0330.07320.53
5.6.160.0030.07020.54
5.6.150.0070.04018.21
5.6.140.0070.08018.14
5.6.130.0130.06018.14
5.6.120.0100.06721.11
5.6.110.0030.09021.02
5.6.100.0070.07021.02
5.6.90.0100.07721.01
5.6.80.0000.06720.36
5.6.70.0400.06020.36
5.5.350.0300.07020.33
5.5.340.0100.07717.97
5.5.330.0070.05020.34
5.5.320.0470.07020.35
5.5.310.0270.05320.26
5.5.300.0100.07017.98
5.5.290.0100.08317.94
5.5.280.0070.08720.78
5.5.270.0030.04320.77
5.5.260.0070.08320.74
5.5.250.0070.05720.56
5.5.240.0330.06320.14
5.4.450.0270.03719.48
5.4.440.0300.06319.32
5.4.430.0370.07319.58
5.4.420.0330.05319.41
5.4.410.0230.07719.42
5.4.400.0270.07318.95
5.4.390.0270.05718.85
5.4.380.0330.07319.22
5.4.370.0400.06019.09
5.4.360.0270.07319.17
5.4.350.0270.03719.08
5.4.340.0400.06019.23
5.4.320.0370.04318.98
5.4.310.0370.06719.13
5.4.300.0300.06719.32
5.4.290.0300.04319.21
5.4.280.0400.04319.09
5.4.270.0300.07019.13
5.4.260.0370.06318.87
5.4.250.0330.04319.14
5.4.240.0370.06319.00
5.4.230.0270.03719.05
5.4.220.0370.06319.21
5.4.210.0230.07718.94
5.4.200.0330.06719.22
5.4.190.0270.04019.21
5.4.180.0230.04018.93
5.4.170.0300.07019.21
5.4.160.0230.04319.15
5.4.150.0300.04318.94
5.4.140.0230.04016.32
5.4.130.0200.03716.35
5.4.120.0300.06316.38
5.4.110.0330.06316.45
5.4.100.0270.06316.40
5.4.90.0300.04016.23
5.4.80.0300.06716.30
5.4.70.0300.06016.54
5.4.60.0230.05316.43
5.4.50.0300.06316.49
5.4.40.0370.05316.23
5.4.30.0270.07316.39
5.4.20.0430.02716.25
5.4.10.0230.04316.51
5.4.00.0270.03315.80
5.3.290.0370.06314.72
5.3.280.0200.07014.52
5.3.270.0270.07014.83
5.3.260.0270.06714.54
5.3.250.0130.06714.62
5.3.240.0300.06314.61
5.3.230.0200.06314.65
5.3.220.0270.06714.66
5.3.210.0230.06314.55
5.3.200.0270.07014.48
5.3.190.0230.07714.55
5.3.180.0400.05714.55
5.3.170.0230.04314.73
5.3.160.0230.05014.66
5.3.150.0330.06014.50
5.3.140.0270.07714.48
5.3.130.0400.07014.64
5.3.120.0300.04314.55
5.3.110.0300.07314.45
5.3.100.0370.06314.05
5.3.90.0300.06313.94
5.3.80.0400.06314.04
5.3.70.0270.07014.05
5.3.60.0230.04714.12
5.3.50.0300.07014.12
5.3.40.0270.07013.88
5.3.30.0300.06313.84
5.3.20.0270.05013.79
5.3.10.0300.05013.68
5.3.00.0270.04713.73
5.2.170.0230.05711.85
5.2.160.0300.04711.85
5.2.150.0200.03711.85
5.2.140.0170.06011.85
5.2.130.0230.05711.85
5.2.120.0200.05711.85
5.2.110.0300.03011.85
5.2.100.0130.04011.85
5.2.90.0130.03011.85
5.2.80.0170.04011.85
5.2.70.0100.03311.85
5.2.60.0200.02311.85
5.2.50.0130.03011.85
5.2.40.0100.03011.85
5.2.30.0130.02711.85
5.2.20.0100.03011.85
5.2.10.0200.02311.85
5.2.00.0200.02011.85
5.1.60.0170.02311.85
5.1.50.0170.02011.85
5.1.40.0100.03011.85
5.1.30.0100.03011.85
5.1.20.0170.02311.85
5.1.10.0070.03011.85
5.1.00.0070.03011.85
5.0.50.0070.03011.85
5.0.40.0070.02011.85
5.0.30.0070.03011.85
5.0.20.0100.01711.85
5.0.10.0030.02311.85
5.0.00.0070.05011.85
4.4.90.0030.01711.85
4.4.80.0100.01311.85
4.4.70.0070.01711.85
4.4.60.0030.01711.85
4.4.50.0030.01711.85
4.4.40.0030.03011.85
4.4.30.0070.02311.85
4.4.20.0070.01311.85
4.4.10.0070.02711.85
4.4.00.0000.03311.85
4.3.110.0100.02011.85
4.3.100.0030.01711.85
4.3.90.0070.01311.85
4.3.80.0030.02711.85
4.3.70.0070.01311.85
4.3.60.0030.01711.85
4.3.50.0100.01011.85
4.3.40.0070.02711.85
4.3.30.0000.01711.85
4.3.20.0000.01711.85
4.3.10.0030.01711.85
4.3.00.0000.01711.85

preferences:
38.73 ms | 401 KiB | 5 Q