3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?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";