3v4l.org

run code in 300+ PHP versions simultaneously
<?php function string_shift_left($input, $inputlen, $bits, &$output = null) { $skip = (int) ($bits / 8); $copylen = (int) ($inputlen - $skip); $offset = $bits % 8; $mask = 0xff >> $offset; $output = str_pad('', $inputlen + 1, "\x00"); var_dump($skip, $copylen, $offset, $mask, $output); if ($offset == 0) { /* Shifting multiples of 8 allows us to simply copy the relevant bytes */ for ($i = 0; $i < $copylen; $i++) { $output[$i] = $input[$i + $skip]; } return; } for ($i = 0; $i < $copylen; $i++) { $left = (ord($input[$i + $skip]) << $offset); $right = (ord($input[$i + $skip + 1]) & $mask); printf("%08b|%08b\n", $left, $right); $output[$i] = chr( | ); } } string_shift_left("\x01\x01\x00", 2, 7, $output); for ($i = 0; $i < strlen($output); $i++) { printf('%08b|', ord($output[$i])); }

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)
5.4.270.0170.04912.39
5.4.260.0090.04912.39
5.4.250.0140.04512.39
5.4.240.0090.03812.39
5.4.230.0070.04112.38
5.4.220.0100.03612.38
5.4.210.0050.04112.38
5.4.200.0110.03612.38
5.4.190.0100.04812.38
5.4.180.0090.04512.38
5.4.170.0120.04912.38
5.4.160.0160.04612.38
5.4.150.0050.04212.38
5.4.140.0110.04312.07
5.4.130.0080.04212.05
5.4.120.0090.03912.02
5.4.110.0070.04212.01
5.4.100.0070.04612.01
5.4.90.0110.04612.01
5.4.80.0130.05412.01
5.4.70.0070.06012.01
5.4.60.0130.04312.01
5.4.50.0090.04512.00
5.4.40.0100.03811.99
5.4.30.0090.05211.99
5.4.20.0080.04211.98
5.4.10.0110.04111.99
5.4.00.0070.04711.48
5.3.280.0100.05012.71
5.3.270.0090.05712.72
5.3.260.0090.05212.72
5.3.250.0120.05912.72
5.3.240.0100.04912.72
5.3.230.0130.04712.71
5.3.220.0150.05212.68
5.3.210.0060.04712.68
5.3.200.0090.04212.68
5.3.190.0100.04212.68
5.3.180.0140.04212.67
5.3.170.0100.04112.67
5.3.160.0160.04912.67
5.3.150.0110.05712.67
5.3.140.0080.04512.66
5.3.130.0140.05612.66
5.3.120.0090.04912.66
5.3.110.0070.04312.66
5.3.100.0090.04312.12
5.3.90.0140.04712.09
5.3.80.0090.04912.08
5.3.70.0070.04612.07
5.3.60.0120.05112.06
5.3.50.0090.04312.00
5.3.40.0050.04312.01
5.3.30.0210.06211.96
5.3.20.0080.05111.75
5.3.10.0100.06011.71
5.3.00.0120.03611.70

preferences:
139.1 ms | 1386 KiB | 7 Q