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 = floatval($parts[1]); $id->hash = $parts[2]; return $id; } public function name() { return $this->name; } public function time() { return $this->time; } public function equals(self $other) { return $this == $other; } 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->equals($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.0090.00915.43
7.4.00.0120.00715.48
7.3.130.0060.01215.43
7.3.120.0120.00615.39
7.3.110.0070.01115.42
7.3.100.0060.00915.43
7.3.90.0070.00915.49
7.3.80.0070.00715.33
7.3.70.0020.01115.40
7.3.60.0050.01115.38
7.3.50.0060.00715.19
7.3.40.0090.00215.26
7.3.30.0050.00815.40
7.3.20.0050.01017.03
7.3.10.0090.00417.01
7.3.00.0070.00717.24
7.2.260.0060.01215.42
7.2.250.0110.00815.58
7.2.240.0060.01015.77
7.2.230.0040.01115.56
7.2.220.0060.00815.36
7.2.210.0040.01015.75
7.2.200.0070.00815.61
7.2.190.0060.00715.44
7.2.180.0060.00615.63
7.2.170.0030.01115.63
7.2.160.0050.01015.69
7.2.150.0070.00717.51
7.2.140.0070.00817.45
7.2.130.0040.01017.42
7.2.120.0040.01217.49
7.2.110.0090.00617.35
7.2.100.0050.01017.43
7.2.90.0080.00817.43
7.2.80.0070.00717.31
7.2.70.0060.01017.58
7.2.60.0070.00917.54
7.2.50.0050.01017.56
7.2.40.0080.00817.49
7.2.30.0050.00817.49
7.2.20.0090.00517.31
7.2.10.0060.01017.36
7.2.00.0080.00617.97
7.1.330.0040.01216.11
7.1.320.0080.00716.20
7.1.310.0060.00616.28
7.1.300.0080.00616.38
7.1.290.0050.00716.26
7.1.280.0040.00916.30
7.1.270.0060.00616.25
7.1.260.0060.00716.27
7.1.250.0020.01216.20
7.1.240.0070.00716.23
7.1.230.0050.00716.28
7.1.220.0080.00616.28
7.1.210.0070.00716.09
7.1.200.0100.00516.35
7.1.190.0050.01016.11
7.1.180.0090.00216.28
7.1.170.0070.00816.25
7.1.160.0080.00616.40
7.1.150.0090.00516.20
7.1.140.0060.00816.19
7.1.130.0030.01316.25
7.1.120.0030.00816.21
7.1.110.0030.01116.30
7.1.100.0060.00716.41
7.1.90.0060.00716.18
7.1.80.0050.00916.24
7.1.70.0070.00716.32
7.1.60.0040.01317.04
7.1.50.0080.00816.45
7.1.40.0050.00916.33
7.1.30.0040.01016.20
7.1.20.0090.00616.15
7.1.10.0080.00516.35
7.1.00.0050.01517.86
7.0.330.0060.00915.86
7.0.320.0070.00715.89
7.0.310.0060.00715.86
7.0.300.0060.00915.79
7.0.290.0050.00815.92
7.0.280.0050.00815.86
7.0.270.0060.00816.02
7.0.260.0060.00615.80
7.0.250.0070.00715.87
7.0.240.0050.00715.99
7.0.230.0070.00715.95
7.0.220.0040.01015.83
7.0.210.0040.00615.90
7.0.200.0100.00716.05
7.0.190.0060.00615.90
7.0.180.0050.00915.93
7.0.170.0040.01115.96
7.0.160.0030.01115.99
7.0.150.0090.00615.93
7.0.140.0070.02217.43
7.0.130.0070.00915.96
7.0.120.0090.00615.94
7.0.110.0130.02316.99
7.0.100.0050.01816.90
7.0.90.0050.01616.96
7.0.80.0100.01617.02
7.0.70.0070.01616.89
7.0.60.0100.01916.95
7.0.50.0060.01417.02
7.0.40.0030.02115.38
7.0.30.0020.01915.39
7.0.20.0050.02415.40
7.0.10.0060.01215.40
7.0.00.0070.02215.36
5.6.400.0040.00814.67
5.6.390.0080.00815.02
5.6.380.0040.01015.16
5.6.370.0030.00814.81
5.6.360.0100.00515.11
5.6.350.0040.01015.09
5.6.340.0050.01014.87
5.6.330.0060.00715.05
5.6.320.0030.01115.05
5.6.310.0060.00815.02
5.6.300.0080.00915.13
5.6.290.0060.00714.94
5.6.280.0080.02416.45
5.6.270.0100.00715.20
5.6.260.0040.01916.30
5.6.250.0060.01516.54
5.6.240.0050.02216.36
5.6.230.0060.01716.51
5.6.220.0050.02216.44
5.6.210.0060.02416.42
5.6.200.0080.01416.37
5.6.190.0060.02416.33
5.6.180.0060.01516.38
5.6.170.0060.02516.33
5.6.160.0080.01316.43
5.6.150.0070.02616.27
5.6.140.0060.02216.36
5.6.130.0050.01916.36
5.6.120.0050.02816.34
5.6.110.0030.02016.34
5.6.100.0050.01716.35
5.6.90.0060.01816.26
5.6.80.0080.02416.19
5.6.70.0050.01516.03
5.6.60.0050.01516.19
5.6.50.0040.02516.17
5.6.40.0070.01516.15
5.6.30.0040.01616.01
5.6.20.0080.01316.29
5.6.10.0070.01516.21
5.6.00.0070.01416.00
5.5.380.0080.02515.57
5.5.370.0030.01715.54
5.5.360.0080.01415.70
5.5.350.0050.02115.39
5.5.340.0010.02115.65
5.5.330.0060.01715.75
5.5.320.0040.01615.73
5.5.310.0050.01915.77
5.5.300.0050.02315.69
5.5.290.0070.02615.63
5.5.280.0060.01515.74
5.5.270.0050.01815.61
5.5.260.0080.02315.81
5.5.250.0070.01915.54
5.5.240.0050.02415.54
5.5.230.0060.01615.45
5.5.220.0070.01815.52
5.5.210.0050.01815.48
5.5.200.0080.01215.48
5.5.190.0050.01515.42
5.5.180.0020.01915.54
5.5.170.0090.00514.85
5.5.160.0040.01815.47
5.5.150.0060.01615.55
5.5.140.0070.01515.39
5.5.130.0070.01515.46
5.5.120.0050.01315.46
5.5.110.0060.01615.43
5.5.100.0070.01515.42
5.5.90.0080.01215.38
5.5.80.0050.01415.37
5.5.70.0080.01215.38
5.5.60.0020.01815.37
5.5.50.0040.01415.40
5.5.40.0030.01615.38
5.5.30.0060.01215.53
5.5.20.0050.01515.45
5.5.10.0100.01015.40
5.5.00.0050.01415.49
5.4.450.0060.02013.77
5.4.440.0060.01413.74
5.4.430.0070.01713.75
5.4.420.0080.01913.67
5.4.410.0040.01813.59
5.4.400.0060.02113.56
5.4.390.0080.01613.63
5.4.380.0040.01513.71
5.4.370.0060.02113.63
5.4.360.0040.01513.48
5.4.350.0050.01913.56
5.4.340.0060.01213.59
5.4.330.0020.00711.83
5.4.320.0070.01613.57
5.4.310.0060.01513.54
5.4.300.0030.01413.65
5.4.290.0040.01213.54
5.4.280.0050.01313.60
5.4.270.0070.01213.54
5.4.260.0060.01213.57
5.4.250.0040.01113.67
5.4.240.0040.01313.73
5.4.230.0030.01213.67
5.4.220.0050.01313.59
5.4.210.0020.01713.47
5.4.200.0030.01213.51
5.4.190.0040.01413.62
5.4.180.0080.00913.57
5.4.170.0040.01213.57
5.4.160.0050.01113.60
5.4.150.0060.01313.65
5.4.140.0080.01112.94
5.4.130.0030.01512.93
5.4.120.0050.01112.93
5.4.110.0060.00913.03
5.4.100.0070.01112.93
5.4.90.0070.01012.95
5.4.80.0040.01312.99
5.4.70.0020.01312.94
5.4.60.0050.01213.07
5.4.50.0020.01412.96
5.4.40.0010.01612.95
5.4.30.0050.01112.97
5.4.20.0030.01313.00
5.4.10.0050.02112.98
5.4.00.0030.02212.78
5.3.290.0040.01312.31
5.3.280.0030.01312.25
5.3.270.0030.01212.38
5.3.260.0020.01312.33
5.3.250.0020.01412.33
5.3.240.0020.01612.32
5.3.230.0040.01412.35
5.3.220.0030.01412.32
5.3.210.0020.01412.30
5.3.200.0020.01512.28
5.3.190.0060.01012.29
5.3.180.0040.01212.34
5.3.170.0030.01412.37
5.3.160.0030.02012.30
5.3.150.0040.01212.37
5.3.140.0040.01312.35
5.3.130.0050.01212.34
5.3.120.0040.01312.35
5.3.110.0050.01512.41
5.3.100.0030.01512.22
5.3.90.0080.01312.27
5.3.80.0020.01412.12
5.3.70.0060.01112.14
5.3.60.0030.01412.15
5.3.50.0040.01712.15
5.3.40.0030.01912.15
5.3.30.0050.01612.03
5.3.20.0050.01212.05
5.3.10.0030.01411.93
5.3.00.0030.01112.00
5.2.170.0000.03012.06
5.2.160.0000.03312.06
5.2.150.0100.02012.06
5.2.140.0070.02312.06
5.2.130.0000.03012.06
5.2.120.0030.03312.06
5.2.110.0000.03012.06
5.2.100.0030.02712.06
5.2.90.0070.03312.06
5.2.80.0030.03012.06
5.2.70.0000.03312.06
5.2.60.0070.02312.06
5.2.50.0000.02712.06
5.2.40.0100.03312.06
5.2.30.0000.03012.06
5.2.20.0000.03012.06
5.2.10.0070.02012.06
5.2.00.0000.02312.06
5.1.60.0030.01712.06
5.1.50.0000.02312.06
5.1.40.0000.02012.06
5.1.30.0030.02012.06
5.1.20.0070.02012.06
5.1.10.0000.04012.06
5.1.00.0030.02012.06
5.0.50.0030.01312.06
5.0.40.0000.01712.06
5.0.30.0000.03312.06
5.0.20.0000.02312.06
5.0.10.0030.01312.06
5.0.00.0030.02312.06
4.4.90.0000.01712.06
4.4.80.0030.01312.06
4.4.70.0000.01712.06
4.4.60.0100.00312.06
4.4.50.0030.01312.06
4.4.40.0000.02012.06
4.4.30.0000.01712.06
4.4.20.0000.02312.06
4.4.10.0000.01312.06
4.4.00.0000.02012.06
4.3.110.0000.01712.06
4.3.100.0000.01312.06
4.3.90.0000.01312.06
4.3.80.0000.02312.06
4.3.70.0000.02012.06
4.3.60.0000.01312.06
4.3.50.0000.01312.06
4.3.40.0030.02012.06
4.3.30.0000.01312.06
4.3.20.0000.02012.06
4.3.10.0000.01312.06
4.3.00.0000.01312.06

preferences:
37.65 ms | 400 KiB | 5 Q