3v4l.org

run code in 300+ PHP versions simultaneously
<?php final class CommandId { private $name; private $time; private $hash; public function __construct($name, $time = null, $hash = null) { $this->time = (float) ($time ?: microtime(true)); $this->name = trim($name); $this->hash = (string) ($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]"); } return new static($parts[0], $parts[1], $parts[2]); } public function name() { return $this->name; } public function time() { return $this->time; } public function equals(self $other) { return ($this->name == $other->name && $this->time == $other->time && $this->hash == $other->hash ); } 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 == $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.00714.89
7.3.120.0090.00914.88
7.3.110.0060.01114.92
7.3.100.0080.01115.03
7.3.90.0040.01114.73
7.3.80.0080.00814.89
7.3.70.0040.01114.91
7.3.60.0040.01214.93
7.3.50.0060.00614.71
7.3.40.0040.01114.84
7.3.30.0030.00614.89
7.3.20.0040.00716.67
7.3.10.0030.01016.80
7.3.00.0100.00316.73
7.2.250.0100.00715.29
7.2.240.0040.01515.26
7.2.230.0000.01515.13
7.2.220.0030.01215.29
7.2.210.0000.01715.33
7.2.200.0030.00915.03
7.2.190.0060.00315.24
7.2.180.0030.01415.21
7.2.170.0000.01215.10
7.2.160.0030.01315.21
7.2.150.0070.00717.05
7.2.140.0070.00717.02
7.2.130.0070.00717.09
7.2.120.0030.01216.91
7.2.110.0080.00417.14
7.2.100.0100.00716.94
7.2.90.0040.01116.98
7.2.80.0030.00816.84
7.2.70.0090.00617.09
7.2.60.0060.00317.19
7.2.50.0060.00617.09
7.2.40.0110.00316.98
7.2.30.0060.01316.77
7.2.20.0110.00717.16
7.2.10.0040.01117.04
7.2.00.0030.01018.02
7.1.330.0080.00315.96
7.1.320.0110.00315.54
7.1.310.0070.01015.82
7.1.300.0030.01315.84
7.1.290.0000.01015.69
7.1.280.0040.00815.88
7.1.270.0080.00615.94
7.1.260.0070.00715.83
7.1.250.0000.01315.68
7.1.240.0150.00015.76
7.1.230.0110.00415.76
7.1.220.0080.00815.80
7.1.210.0100.00715.61
7.1.200.0060.00915.59
7.1.190.0060.00915.76
7.1.180.0040.00415.64
7.1.170.0000.01215.76
7.1.160.0030.01215.76
7.1.150.0060.00915.45
7.1.140.0070.00715.79
7.1.130.0030.00915.92
7.1.120.0100.00315.77
7.1.110.0100.00315.73
7.1.100.0080.00416.05
7.1.90.0000.01115.54
7.1.80.0000.01415.52
7.1.70.0050.00616.35
7.1.60.0130.00517.41
7.1.50.0080.01016.29
7.1.40.0090.00615.75
7.1.30.0090.00615.73
7.1.20.0120.00315.71
7.1.10.0070.00715.82
7.1.00.0060.01819.17
7.0.330.0060.00915.49
7.0.320.0070.01015.50
7.0.310.0060.00615.36
7.0.300.0000.01215.43
7.0.290.0070.01015.43
7.0.280.0080.00415.27
7.0.270.0000.00815.50
7.0.260.0030.00915.28
7.0.250.0100.00315.26
7.0.240.0000.01215.41
7.0.230.0070.00715.39
7.0.220.0040.01115.21
7.0.210.0060.00615.27
7.0.200.0080.00416.18
7.0.190.0070.00715.55
7.0.180.0040.01115.18
7.0.170.0040.01115.42
7.0.160.0000.01215.61
7.0.150.0040.01115.38
7.0.140.0000.04418.65
7.0.130.0040.01115.58
7.0.120.0030.00515.58
7.0.110.0050.00315.47
7.0.100.0050.00515.57
7.0.90.0030.01015.54
7.0.80.0030.01115.50
7.0.70.0100.00315.21
7.0.60.0070.04517.65
7.0.50.0080.03316.68
7.0.40.0090.04616.95
7.0.30.0180.04016.84
7.0.20.0030.03116.81
7.0.10.0110.03316.89
7.0.00.0080.04116.91
5.6.400.0000.00814.57
5.6.390.0030.01114.44
5.6.380.0120.00314.48
5.6.370.0070.01014.48
5.6.360.0060.00614.42
5.6.350.0090.00914.70
5.6.340.0040.01214.87
5.6.330.0100.00314.63
5.6.320.0120.00014.57
5.6.310.0000.01514.16
5.6.300.0150.00014.62
5.6.290.0080.00314.23
5.6.280.0030.04017.59
5.6.270.0000.01414.48
5.6.260.0040.00814.29
5.6.250.0030.00614.43
5.6.240.0030.00614.27
5.6.230.0060.00314.59
5.6.220.0060.00614.37
5.6.210.0030.03817.66
5.6.200.0080.03016.37
5.6.190.0100.03317.54
5.6.180.0200.04317.57
5.6.170.0180.04717.51
5.6.160.0020.03817.53
5.6.150.0100.04316.26
5.6.140.0060.02216.19
5.6.130.0110.03616.48
5.6.120.0190.03517.84
5.6.110.0040.03417.81
5.6.100.0070.04717.66
5.6.90.0050.04517.88
5.6.80.0090.04217.33
5.6.70.0210.03517.58
5.6.60.0030.00714.38
5.6.50.0030.00714.07
5.6.40.0040.01114.36
5.6.30.0040.01114.31
5.6.20.0030.00914.45
5.6.10.0060.01014.62
5.6.00.0060.00314.40
5.5.380.0000.01314.55
5.5.370.0060.00614.35
5.5.360.0060.00914.63
5.5.350.0070.04017.50
5.5.340.0070.02316.30
5.5.330.0030.02717.44
5.5.320.0120.02417.29
5.5.310.0120.02317.26
5.5.300.0020.03016.17
5.5.290.0030.02816.17
5.5.280.0120.04217.63
5.5.270.0080.02017.62
5.5.260.0020.04717.54
5.5.250.0070.03317.59
5.5.240.0040.04417.38
5.5.230.0050.00314.23
5.5.220.0030.00914.39
5.5.210.0080.00614.60
5.5.200.0110.00414.39
5.5.190.0080.00014.56
5.5.180.0100.00714.14
5.5.170.0040.01114.14
5.5.160.0090.00314.50
5.5.150.0040.01114.46
5.5.140.0080.00614.14
5.5.130.0030.00614.39
5.5.120.0030.00914.29
5.5.110.0070.00714.58
5.5.100.0040.00713.95
5.5.90.0060.01214.26
5.5.80.0030.01014.45
5.5.70.0060.00614.39
5.5.60.0080.00514.44
5.5.50.0040.01114.63
5.5.40.0040.01114.36
5.5.30.0000.01414.34
5.5.20.0040.00814.50
5.5.10.0060.00614.25
5.5.00.0100.00314.18
5.4.450.0180.04015.31
5.4.440.0150.02315.29
5.4.430.0200.02215.40
5.4.420.0190.02515.34
5.4.410.0170.02815.42
5.4.400.0200.02815.06
5.4.390.0170.02515.22
5.4.380.0150.02215.10
5.4.370.0150.03715.19
5.4.360.0150.03615.14
5.4.350.0170.03515.18
5.4.340.0180.03215.01
5.4.330.0000.01411.09
5.4.320.0200.03715.03
5.4.310.0130.02315.15
5.4.300.0160.02615.21
5.4.290.0200.03515.11
5.4.280.0160.03915.09
5.4.270.0120.02415.07
5.4.260.0150.02215.18
5.4.250.0150.03015.05
5.4.240.0270.02215.23
5.4.230.0160.02815.14
5.4.220.0160.02115.10
5.4.210.0170.02914.96
5.4.200.0210.02015.23
5.4.190.0220.03015.08
5.4.180.0200.03415.12
5.4.170.0170.02315.02
5.4.160.0170.02215.17
5.4.150.0120.03915.07
5.4.140.0120.03313.80
5.4.130.0150.03813.80
5.4.120.0150.03913.73
5.4.110.0200.03713.85
5.4.100.0150.03813.66
5.4.90.0180.02313.70
5.4.80.0120.04113.76
5.4.70.0240.03013.76
5.4.60.0190.02313.58
5.4.50.0180.03713.72
5.4.40.0160.02113.83
5.4.30.0210.03113.81
5.4.20.0220.03213.81
5.4.10.0200.03613.63
5.4.00.0180.04113.52
5.3.290.0190.02412.50
5.3.280.0120.02312.42
5.3.270.0180.02312.55
5.3.260.0250.03512.53
5.3.250.0170.03612.41
5.3.240.0220.03212.41
5.3.230.0150.03812.38
5.3.220.0130.04512.23
5.3.210.0230.03312.39
5.3.200.0180.03812.48
5.3.190.0160.03612.40
5.3.180.0220.03212.54
5.3.170.0220.02012.55
5.3.160.0260.02712.41
5.3.150.0200.03912.60
5.3.140.0160.02612.46
5.3.130.0180.02812.49
5.3.120.0210.03412.47
5.3.110.0200.03312.57
5.3.100.0200.03312.24
5.3.90.0150.02912.15
5.3.80.0230.02312.23
5.3.70.0180.01912.05
5.3.60.0150.03312.25
5.3.50.0130.03612.11
5.3.40.0170.02412.12
5.3.30.0150.02512.25
5.3.20.0130.04212.02
5.3.10.0260.02811.84
5.3.00.0160.02611.90
5.2.170.0300.05312.96
5.2.160.0230.05712.96
5.2.150.0230.04012.96
5.2.140.0170.04012.96
5.2.130.0330.02312.96
5.2.120.0230.05712.96
5.2.110.0330.04712.96
5.2.100.0200.06012.96
5.2.90.0330.02712.96
5.2.80.0270.05712.96
5.2.70.0270.04712.96
5.2.60.0230.05012.96
5.2.50.0300.05312.96
5.2.40.0300.03712.96
5.2.30.0230.05012.96
5.2.20.0270.05312.96
5.2.10.0200.06012.96
5.2.00.0200.05312.96
5.1.60.0170.02312.96
5.1.50.0230.04312.96
5.1.40.0100.03712.96
5.1.30.0130.03312.96
5.1.20.0130.04012.96
5.1.10.0170.03312.96
5.1.00.0100.02712.96
5.0.50.0030.02312.96
5.0.40.0070.02012.96
5.0.30.0030.03312.96
5.0.20.0070.02012.96
5.0.10.0030.02012.96
5.0.00.0100.02712.96
4.4.90.0100.02012.96
4.4.80.0170.01712.96
4.4.70.0200.02312.96
4.4.60.0100.03312.96
4.4.50.0100.03012.96
4.4.40.0100.04712.96
4.4.30.0100.03712.96
4.4.20.0070.01712.96
4.4.10.0070.01312.96
4.4.00.0030.02712.96
4.3.110.0030.01712.96
4.3.100.0070.01312.96
4.3.90.0070.01312.96
4.3.80.0070.02312.96
4.3.70.0070.01312.96
4.3.60.0070.03312.96
4.3.50.0030.01712.96
4.3.40.0030.02312.96
4.3.30.0070.01312.96
4.3.20.0030.01712.96
4.3.10.0030.01312.96
4.3.00.0000.02712.96

preferences:
33.72 ms | 401 KiB | 5 Q