3v4l.org

run code in 300+ PHP versions simultaneously
<?php final class CommandId { private $name; private $time; public function __construct($name) { $this->time = microtime(); $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 = (int) $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.10.0110.00714.73
7.4.00.0060.01014.80
7.3.130.0070.01314.88
7.3.120.0110.00314.94
7.3.110.0040.01014.89
7.3.100.0050.00614.70
7.3.90.0050.00914.83
7.3.80.0060.01014.75
7.3.70.0090.00414.95
7.3.60.0040.00914.80
7.3.50.0050.00714.71
7.3.40.0060.00814.78
7.3.30.0060.00814.82
7.3.20.0070.00816.83
7.3.10.0090.00316.59
7.3.00.0050.01016.59
7.2.260.0070.01115.21
7.2.250.0080.00915.07
7.2.240.0080.01015.17
7.2.230.0060.01015.17
7.2.220.0070.01015.05
7.2.210.0080.00614.92
7.2.200.0080.00714.98
7.2.190.0070.00814.98
7.2.180.0080.00514.97
7.2.170.0070.00614.99
7.2.160.0050.00915.07
7.2.150.0030.00916.73
7.2.140.0060.00816.90
7.2.130.0080.00816.74
7.2.120.0100.00616.85
7.2.110.0050.00716.80
7.2.100.0030.01216.73
7.2.90.0070.00916.87
7.2.80.0060.01116.91
7.2.70.0070.00916.89
7.2.60.0060.01016.82
7.2.50.0050.00716.80
7.2.40.0050.00916.74
7.2.30.0070.00716.91
7.2.20.0020.01116.77
7.2.10.0060.00916.74
7.2.00.0050.01017.31
7.1.330.0060.00915.88
7.1.320.0070.00915.79
7.1.310.0040.00915.52
7.1.300.0050.00815.86
7.1.290.0080.00715.66
7.1.280.0080.00615.71
7.1.270.0070.00715.79
7.1.260.0010.01115.55
7.1.250.0100.00815.79
7.1.240.0060.00315.47
7.1.230.0030.00915.81
7.1.220.0060.00615.80
7.1.210.0040.01115.73
7.1.200.0060.00315.74
7.1.190.0000.01515.73
7.1.180.0110.00715.82
7.1.170.0040.00815.77
7.1.160.0090.00615.70
7.1.150.0100.00715.73
7.1.140.0070.00715.64
7.1.130.0080.00415.76
7.1.120.0090.00615.84
7.1.110.0090.00615.79
7.1.100.0040.01115.80
7.1.90.0100.00315.68
7.1.80.0090.00315.79
7.1.70.0030.00816.47
7.1.60.0130.00217.71
7.1.50.0060.01016.37
7.1.40.0070.00715.49
7.1.30.0000.00815.61
7.1.20.0100.00015.91
7.1.10.0080.00615.79
7.1.00.0020.02919.01
7.0.330.0100.00315.41
7.0.320.0000.01015.24
7.0.310.0040.00415.20
7.0.300.0070.01015.41
7.0.290.0070.00715.59
7.0.280.0060.00615.20
7.0.270.0000.01615.54
7.0.260.0060.00915.50
7.0.250.0070.00715.54
7.0.240.0040.01115.41
7.0.230.0070.00715.27
7.0.220.0040.01115.23
7.0.210.0040.00415.55
7.0.200.0080.00816.01
7.0.190.0100.00015.58
7.0.180.0040.00815.59
7.0.170.0070.00715.42
7.0.160.0070.00715.59
7.0.150.0060.00615.28
7.0.140.0050.04118.65
7.0.130.0030.01015.61
7.0.120.0060.01015.56
7.0.110.0000.01015.20
7.0.100.0050.04717.80
7.0.90.0050.04717.70
7.0.80.0050.04017.58
7.0.70.0070.04617.70
7.0.60.0030.04517.74
7.0.50.0030.04317.96
7.0.40.0130.03216.85
7.0.30.0070.04216.65
7.0.20.0050.04516.75
7.0.10.0030.04116.80
7.0.00.0000.04716.77
5.6.400.0000.01313.96
5.6.390.0070.01014.28
5.6.380.0030.01014.30
5.6.370.0070.00714.75
5.6.360.0040.01114.76
5.6.350.0030.01214.47
5.6.340.0030.01314.42
5.6.330.0000.00914.40
5.6.320.0070.01014.34
5.6.310.0060.00614.56
5.6.300.0030.01314.42
5.6.290.0120.00314.29
5.6.280.0070.03517.87
5.6.270.0070.01014.57
5.6.260.0110.00314.53
5.6.250.0120.03817.61
5.6.240.0060.03917.54
5.6.230.0050.04617.51
5.6.220.0060.04117.41
5.6.210.0120.04017.44
5.6.200.0080.04617.78
5.6.190.0030.04917.79
5.6.180.0080.03617.59
5.6.170.0110.04017.89
5.6.160.0070.04317.75
5.6.150.0070.04517.68
5.6.140.0020.05017.77
5.6.130.0080.02617.67
5.6.120.0040.03817.64
5.6.110.0050.04117.88
5.6.100.0120.04017.78
5.6.90.0110.04017.57
5.6.80.0080.03517.48
5.6.70.0060.04317.41
5.6.60.0020.04917.47
5.6.50.0080.03617.48
5.6.40.0070.03717.30
5.6.30.0070.02317.40
5.6.20.0100.03317.48
5.6.10.0070.04617.41
5.6.00.0080.03317.41
5.5.380.0050.04417.33
5.5.370.0080.04017.37
5.5.360.0070.04617.40
5.5.350.0130.03517.32
5.5.340.0050.04417.39
5.5.330.0000.05317.51
5.5.320.0050.04317.50
5.5.310.0130.04117.47
5.5.300.0070.04317.61
5.5.290.0080.04117.65
5.5.280.0080.02317.60
5.5.270.0050.04517.71
5.5.260.0130.03817.58
5.5.250.0050.04717.36
5.5.240.0090.04017.26
5.5.230.0050.04717.18
5.5.220.0090.03016.95
5.5.210.0000.04817.18
5.5.200.0120.02717.11
5.5.190.0080.04217.21
5.5.180.0060.03517.25
5.5.170.0110.00414.23
5.5.160.0050.02717.30
5.5.150.0180.01517.13
5.5.140.0100.01817.32
5.5.130.0080.02817.32
5.5.120.0030.02717.35
5.5.110.0060.02217.26
5.5.100.0020.02617.15
5.5.90.0100.02017.28
5.5.80.0070.02317.18
5.5.70.0100.04117.24
5.5.60.0090.03917.13
5.5.50.0030.03917.00
5.5.40.0030.03317.19
5.5.30.0050.02717.26
5.5.20.0050.02517.07
5.5.10.0080.04517.06
5.5.00.0090.02716.99
5.4.450.0050.04516.27
5.4.440.0030.02716.42
5.4.430.0060.04516.42
5.4.420.0100.04016.36
5.4.410.0070.02516.30
5.4.400.0110.03016.28
5.4.390.0050.04416.27
5.4.380.0100.03516.29
5.4.370.0030.04216.15
5.4.360.0050.04316.15
5.4.350.0050.04416.12
5.4.340.0030.04416.29
5.4.330.0040.00713.35
5.4.320.0050.02916.24
5.4.310.0020.02416.18
5.4.300.0030.02316.24
5.4.290.0040.02316.24
5.4.280.0080.01816.13
5.4.270.0030.02316.26
5.4.260.0020.02516.15
5.4.250.0070.01916.26
5.4.240.0050.02816.25
5.4.230.0030.04316.12
5.4.220.0000.02716.29
5.4.210.0060.02616.19
5.4.200.0050.03216.20
5.4.190.0050.02116.24
5.4.180.0020.03316.19
5.4.170.0030.02416.25
5.4.160.0000.04416.09
5.4.150.0050.02216.24
5.4.140.0030.02514.89
5.4.130.0040.03014.85
5.4.120.0020.02514.88
5.4.110.0060.02514.87
5.4.100.0030.02114.81
5.4.90.0020.02414.89
5.4.80.0060.03814.92
5.4.70.0050.02314.90
5.4.60.0050.02014.87
5.4.50.0010.02114.83
5.4.40.0100.01514.90
5.4.30.0020.02014.83
5.4.20.0050.02514.91
5.4.10.0050.03714.80
5.4.00.0080.02314.57
5.3.290.0070.02814.07
5.3.280.0040.03814.00
5.3.270.0040.04014.05
5.3.260.0020.03013.99
5.3.250.0020.02314.04
5.3.240.0040.02513.96
5.3.230.0040.02313.97
5.3.220.0050.03314.00
5.3.210.0040.02113.93
5.3.200.0040.02413.95
5.3.190.0010.02414.03
5.3.180.0000.02414.01
5.3.170.0030.02214.02
5.3.160.0020.02214.01
5.3.150.0030.02214.02
5.3.140.0050.02714.01
5.3.130.0050.02013.96
5.3.120.0020.03513.94
5.3.110.0060.03813.98
5.3.100.0060.03813.69
5.3.90.0030.04513.72
5.3.80.0100.03413.65
5.3.70.0080.03313.68
5.3.60.0030.03313.67
5.3.50.0050.04013.62
5.3.40.0070.03813.65
5.3.30.0060.04113.70
5.3.20.0020.03213.59
5.3.10.0090.02813.59
5.3.00.0050.04213.59
5.2.170.0000.06713.83
5.2.160.0130.05313.83
5.2.150.0030.06013.83
5.2.140.0070.06013.83
5.2.130.0000.06313.83
5.2.120.0070.03713.83
5.2.110.0100.06013.83
5.2.100.0030.05713.83
5.2.90.0170.04713.83
5.2.80.0000.06313.83
5.2.70.0100.06013.83
5.2.60.0070.05713.83
5.2.50.0030.06013.83
5.2.40.0000.05313.83
5.2.30.0070.06013.83
5.2.20.0030.05013.83
5.2.10.0100.05713.83
5.2.00.0030.06313.83
5.1.60.0000.05013.83
5.1.50.0000.05313.83
5.1.40.0000.06013.83
5.1.30.0070.05313.83
5.1.20.0100.05313.83
5.1.10.0030.05713.83
5.1.00.0070.05313.83
5.0.50.0030.04713.83
5.0.40.0070.03013.83
5.0.30.0000.06013.83
5.0.20.0030.04713.83
5.0.10.0030.02713.83
5.0.00.0030.06013.83
4.4.90.0070.03013.83
4.4.80.0030.03313.83
4.4.70.0030.03313.83
4.4.60.0070.02013.83
4.4.50.0030.03713.83
4.4.40.0070.03313.83
4.4.30.0030.03313.83
4.4.20.0070.03313.83
4.4.10.0000.03713.83
4.4.00.0030.05713.83
4.3.110.0070.03313.83
4.3.100.0000.02313.83
4.3.90.0030.02013.83
4.3.80.0070.05013.83
4.3.70.0030.03313.83
4.3.60.0000.03713.83
4.3.50.0070.03013.83
4.3.40.0030.05013.83
4.3.30.0030.03313.83
4.3.20.0030.03313.83
4.3.10.0000.02313.83
4.3.00.0030.03313.83

preferences:
35.23 ms | 400 KiB | 5 Q