3v4l.org

run code in 300+ PHP versions simultaneously
<?php $aShitLoadOfSpaces = ' '; $headerName = 'CONTENT-LENGTH'; $start = microtime(true); for ($i = 0; $i < 500000; $i++) { if (strtolower($headerName) === 'content-length') {} } $duration = microtime(true) - $start; echo "strtolower: $duration\n"; $start = microtime(true); for ($i = 0; $i < 500000; $i++) { if ((($aShitLoadOfSpaces & $headerName) | $headerName) === 'content-length') {} } $duration = microtime(true) - $start; echo "Bitwise 1: $duration\n"; $start = microtime(true); for ($i = 0; $i < 500000; $i++) { if (trim($aShitLoadOfSpaces | $headerName) === 'content-length') {} } $duration = microtime(true) - $start; echo "Bitwise 2: $duration\n";

preferences:
36.29 ms | 402 KiB | 5 Q