3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Guid { private $guid = ''; public function __construct($guid) { $this->guid = $guid; } public static function newGuid() { return new Guid('35918bc9-196d-40ea-9779-889d79b753f0'); } public function __toString() { return $this->guid; } public function toByteArray() { $str = str_replace('-', '', $this->guid); $ints = array_map('hexdec', str_split($str, 2)); // swap $newints = $ints; $newints[0] = $ints[3]; $newints[1] = $ints[2]; $newints[2] = $ints[1]; $newints[3] = $ints[0]; $newints[4] = $ints[5]; $newints[5] = $ints[4]; $newints[6] = $ints[7]; $newints[7] = $ints[6]; return implode('', array_map('chr', $newints)); } public function printBytes($bytes) { for ($i = 0; $i < strlen($bytes); $i++) { echo strtoupper(dechex(ord($bytes[$i]))).' '; } echo "\n"; } } $guid = Guid::newGuid(); $str = $guid->toByteArray(); $guid->printBytes($str);

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)
8.3.60.0060.00918.41
8.3.50.0110.00418.15
8.3.40.0080.01118.84
8.3.30.0110.00418.91
8.3.20.0030.00619.10
8.3.10.0000.00819.29
8.3.00.0040.00423.68
8.2.180.0110.01117.93
8.2.170.0040.01122.96
8.2.160.0150.00421.02
8.2.150.0050.00325.66
8.2.140.0040.00424.66
8.2.130.0050.00319.77
8.2.120.0090.00026.35
8.2.110.0060.00320.99
8.2.100.0080.00317.84
8.2.90.0030.00618.16
8.2.80.0040.00418.81
8.2.70.0040.00417.50
8.2.60.0000.00818.05
8.2.50.0030.00518.07
8.2.40.0090.00019.78
8.2.30.0080.00017.74
8.2.20.0000.00818.18
8.2.10.0030.00518.08
8.2.00.0030.00319.41
8.1.280.0030.01325.92
8.1.270.0040.00422.20
8.1.260.0030.00526.35
8.1.250.0040.00428.09
8.1.240.0000.01317.48
8.1.230.0120.00020.89
8.1.220.0040.00417.74
8.1.210.0000.00918.77
8.1.200.0070.00317.35
8.1.190.0000.00817.13
8.1.180.0040.00418.10
8.1.170.0000.00718.88
8.1.160.0070.00019.07
8.1.150.0000.00718.82
8.1.140.0040.00418.90
8.1.130.0000.00719.01
8.1.120.0000.00717.52
8.1.110.0000.00717.47
8.1.100.0040.00417.40
8.1.90.0040.00417.43
8.1.80.0000.00817.51
8.1.70.0040.00417.38
8.1.60.0030.00617.45
8.1.50.0040.00417.45
8.1.40.0000.00817.41
8.1.30.0030.00517.64
8.1.20.0090.00017.49
8.1.10.0040.00417.56
8.1.00.0000.00817.50
8.0.300.0040.00418.77
8.0.290.0040.00416.63
8.0.280.0030.00318.58
8.0.270.0030.00318.05
8.0.260.0000.00817.25
8.0.250.0030.00316.96
8.0.240.0060.00316.93
8.0.230.0080.00016.98
8.0.220.0070.00016.89
8.0.210.0040.00416.92
8.0.200.0000.00616.95
8.0.190.0070.00016.99
8.0.180.0050.00216.91
8.0.170.0090.00016.93
8.0.160.0050.00216.79
8.0.150.0040.00416.89
8.0.140.0040.00416.83
8.0.130.0030.00313.36
8.0.120.0030.00516.89
8.0.110.0040.00416.88
8.0.100.0000.00716.79
8.0.90.0050.00316.87
8.0.80.0080.00816.88
8.0.70.0000.00716.88
8.0.60.0000.00716.78
8.0.50.0030.00516.96
8.0.30.0120.00917.32
8.0.20.0090.01217.40
8.0.10.0050.00216.90
8.0.00.0060.01116.97
7.4.330.0050.00015.55
7.4.320.0000.00616.45
7.4.300.0000.00616.59
7.4.290.0040.00416.54
7.4.280.0040.00416.41
7.4.270.0000.00616.37
7.4.260.0000.00716.57
7.4.250.0040.00416.47
7.4.240.0000.00716.61
7.4.230.0070.00016.54
7.4.220.0070.00016.52
7.4.210.0050.01216.59
7.4.200.0030.00316.41
7.4.160.0100.00616.57
7.4.140.0060.01317.86
7.4.130.0180.00716.50
7.4.120.0110.00716.52
7.4.110.0170.00016.51
7.4.100.0090.00816.41
7.4.90.0120.00616.41
7.4.80.0060.01219.39
7.4.70.0180.00016.57
7.4.60.0060.00916.25
7.4.50.0060.00916.55
7.4.40.0040.02016.36
7.4.00.0070.00414.99
7.3.330.0000.00513.20
7.3.320.0060.00013.30
7.3.310.0070.00016.23
7.3.300.0000.00716.38
7.3.290.0000.00616.24
7.3.280.0060.01216.39
7.3.260.0150.00616.42
7.3.240.0130.00616.37
7.3.230.0120.01216.44
7.3.210.0060.01516.36
7.3.200.0100.00716.34
7.3.190.0050.01016.47
7.3.180.0110.00816.43
7.3.170.0040.01416.61
7.3.160.0110.00616.34
7.3.10.0100.00316.12
7.3.00.0030.00616.58
7.2.330.0110.00716.55
7.2.320.0070.01416.90
7.2.310.0030.01616.90
7.2.300.0100.01016.43
7.2.290.0130.00716.63
7.2.130.0040.01116.97
7.2.120.0000.01516.54
7.2.110.0150.00816.63
7.2.100.0000.01416.61
7.2.90.0130.00616.50
7.2.80.0090.00016.59
7.2.70.0030.01216.77
7.2.60.4110.00815.63
7.2.50.2740.01115.76
7.2.40.2040.01016.16
7.2.30.0410.00916.06
7.2.20.0190.00816.09
7.2.10.0460.00816.04
7.2.00.0430.00616.19
7.1.250.0040.01115.45
7.1.200.0040.00815.80
7.1.170.4410.00613.97
7.1.160.2480.01216.80
7.1.150.2310.01117.26
7.1.140.4250.01116.76
7.1.130.4170.01116.93
7.1.120.5160.01116.97
7.1.110.0140.00816.46
7.1.100.0120.01516.37
7.1.90.0130.00816.37
7.1.80.0120.00716.41
7.1.70.3700.00915.39
7.1.60.0270.01233.29
7.1.50.6160.01433.18
7.1.40.6680.01832.45
7.1.30.6480.02432.72
7.1.20.0750.01732.73
7.1.10.1120.01114.63
7.1.00.5000.01015.04

preferences:
55.05 ms | 400 KiB | 5 Q