3v4l.org

run code in 300+ PHP versions simultaneously
<?php $score = 64; $firstName = 'Jack'; $lastName = 'Saliv'; $age = 21; $expected = 'FFFEFF404A00610063006B00530061006C00690076FFFEFF15'; $expectedCorrected = 'FFFEFF404A00610063006B00530061006C0069007600FFFEFF15'; // Convert to UTF-16LE and get hex, https://stackoverflow.com/a/16080439/231316 $nameAsUtf16LE = unpack('H*', mb_convert_encoding($firstName.$lastName, 'UTF-16LE', 'UTF-8')); // UTF-16LE BOM $utf16LeBom = 'FFFE'; // Convert to hex strings $scoreAsHex = dechex($score); $ageAsHex = dechex($age); $finalString = sprintf( '%1$s%2$s%3$s', $utf16LeBom.$scoreAsHex, strtoupper($nameAsUtf16LE[1]), // This is 1-based, not 0-based $utf16LeBom.$ageAsHex, ); $numberPadding = 'FF'; $finalStringWithNumbersPadded = sprintf( '%1$s%2$s%3$s', $utf16LeBom.$numberPadding.$scoreAsHex, strtoupper($nameAsUtf16LE[1]), // This is 1-based, not 0-based $utf16LeBom.$numberPadding.$ageAsHex, ); echo 'Calculated : '.$finalString; echo PHP_EOL; echo 'Padded : '.$finalStringWithNumbersPadded; echo PHP_EOL; echo 'Expected : '.$expected; echo PHP_EOL; echo 'Expected Corrected : '.$expectedCorrected; assert($finalStringWithNumbersPadded === $expectedCorrected);

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.5.30.0100.00721.21
8.5.20.0130.00721.93
8.5.10.0080.01219.58
8.5.00.0130.01020.26
8.4.180.0160.00619.68
8.4.170.0140.01020.47
8.4.160.0150.00720.60
8.4.150.0030.00014.05
8.4.140.0110.01217.78
8.4.130.0060.00518.01
8.4.120.0120.00824.05
8.4.110.0140.00718.87
8.4.100.0140.00618.82
8.4.90.0050.00420.79
8.4.80.0120.00718.63
8.4.70.0100.00619.48
8.4.60.0100.00618.68
8.4.50.0040.00420.54
8.4.40.0040.01520.51
8.4.30.0160.00323.91
8.4.20.0120.00919.85
8.4.10.0160.00322.15
8.3.300.0130.00819.33
8.3.290.0120.00920.88
8.3.280.0170.00518.25
8.3.270.0130.00816.46
8.3.260.0130.00516.61
8.3.250.0070.00619.00
8.3.240.0040.00516.64
8.3.230.0170.00416.50
8.3.220.0060.00219.16
8.3.210.0040.00418.46
8.3.200.0140.00316.59
8.3.190.0090.00617.30
8.3.180.0090.01116.69
8.3.170.0090.00917.05
8.3.160.0110.00718.74
8.3.150.0080.00016.77
8.3.140.0140.00016.60
8.3.130.0040.00416.72
8.3.120.0060.00320.54
8.3.110.0150.00320.94
8.3.100.0060.00324.06
8.3.90.0030.00526.77
8.3.80.0030.00617.97
8.3.70.0110.01116.50
8.3.60.0100.00716.36
8.3.50.0060.01516.35
8.3.40.0140.00023.65
8.3.30.0070.00718.86
8.3.20.0070.00024.18
8.3.10.0040.00424.66
8.3.00.0030.00626.16
8.2.300.0130.00920.19
8.2.290.0060.00320.67
8.2.280.0130.00618.65
8.2.270.0080.01117.25
8.2.260.0080.00016.43
8.2.250.0040.00418.38
8.2.240.0000.00918.95
8.2.230.0030.00622.58
8.2.220.0070.00337.54
8.2.210.0080.00826.77
8.2.200.0030.00616.50
8.2.190.0090.01216.58
8.2.180.0170.00316.50
8.2.170.0180.00322.96
8.2.160.0110.00422.96
8.2.150.0040.00425.66
8.2.140.0000.00824.66
8.2.130.0070.00026.16
8.2.120.0000.00926.16
8.2.110.0070.00322.29
8.2.100.0070.00320.43
8.2.60.0120.00418.06
8.1.340.0090.01021.88
8.1.330.0100.00416.32
8.1.320.0220.00716.34
8.1.310.0060.00918.64
8.1.300.0120.00917.96
8.1.290.0060.00330.84
8.1.280.0100.00725.92
8.1.270.0000.00824.66
8.1.260.0050.00226.35
8.1.250.0030.00528.09
8.1.240.0070.00320.28
8.1.230.0030.00618.68
7.3.250.0050.00616.52
7.3.00.0060.00617.77
7.2.340.0140.00016.52
7.1.260.0080.00416.65
7.0.00.0040.00516.54
5.6.400.0070.00416.52

preferences:
43.18 ms | 894 KiB | 5 Q