3v4l.org

run code in 300+ PHP versions simultaneously
<?php declare(strict_types = 1); function readUnsignedVarLong(string $buffer, int &$offset) : int{ $value = 0; for($i = 0; $i <= 63; $i += 7){ if(!isset($buffer[$offset])){ throw new Exception("No bytes left in buffer"); } $b = ord($buffer[$offset++]); $value |= (($b & 0x7f) << $i); if(($b & 0x80) === 0){ return $value; } } throw new Exception("VarLong did not terminate after 10 bytes!"); } $a = 0; var_dump(readUnsignedVarLong(str_repeat(chr(255), 9) . chr(0x80 << 1), $a), PHP_INT_MAX);

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.0100.01016.63
8.3.50.0100.01016.47
8.3.40.0000.01420.10
8.3.30.0090.00618.67
8.3.20.0040.00424.18
8.3.10.0090.00024.66
8.3.00.0080.00026.16
8.2.180.0100.01016.75
8.2.170.0180.00418.88
8.2.160.0070.00722.96
8.2.150.0000.00725.66
8.2.140.0050.00324.66
8.2.130.0040.00426.16
8.2.120.0050.00326.16
8.2.110.0110.00619.32
8.2.100.0090.00317.84
8.2.90.0000.00817.88
8.2.80.0040.00418.78
8.2.70.0040.00417.63
8.2.60.0000.00817.50
8.2.50.0080.00017.55
8.2.40.0110.00617.62
8.2.30.0140.00317.62
8.2.20.0080.00817.62
8.2.10.0140.00317.62
8.2.00.0100.00517.62
8.1.280.0110.00725.92
8.1.270.0030.00624.66
8.1.260.0040.01526.35
8.1.250.0040.00428.09
8.1.240.0060.00319.32
8.1.230.0070.00420.95
8.1.220.0000.00818.55
8.1.210.0000.00818.77
8.1.200.0040.00417.51
8.1.190.0000.00917.23
8.1.180.0050.00318.10
8.1.170.0150.00617.62
8.1.160.0080.00817.62
8.1.150.0120.00617.62
8.1.140.0090.00917.62
8.1.130.0160.00317.62
8.1.120.0070.01117.62
8.1.110.0130.00417.62
8.1.100.0040.01417.62
8.1.90.0170.00017.62
8.1.80.0080.00817.62
8.1.70.0140.00317.62
8.1.60.0130.00517.62
8.1.50.0120.00417.62
8.1.40.0130.00317.62
8.1.30.0120.00617.62
8.1.20.0140.00317.62
8.1.10.0170.00017.62
8.1.00.0140.00717.62
8.0.300.0070.00018.77
8.0.290.0080.00016.75
8.0.280.0100.00717.62
8.0.270.0090.00917.62
8.0.260.0110.00517.62
8.0.250.0170.00017.62
8.0.240.0160.00017.62
8.0.230.0110.00717.62
8.0.220.0130.00317.62
8.0.210.0130.00317.62
8.0.200.0100.00717.62
8.0.190.0130.00617.62
8.0.180.0120.00417.62
8.0.170.0080.00817.62
8.0.160.0100.00617.62
8.0.150.0110.00617.62
8.0.140.0130.00317.62
8.0.130.0120.00317.62
8.0.120.0080.00817.62
8.0.110.0100.00717.62
8.0.100.0100.00517.62
8.0.90.0160.00017.62
8.0.80.0100.00517.62
8.0.70.0130.00317.62
8.0.60.0170.00017.62
8.0.50.0130.00317.62
8.0.30.0100.00717.62
8.0.20.0160.00017.62
8.0.10.0110.00617.62

preferences:
31.7 ms | 400 KiB | 5 Q