3v4l.org

run code in 300+ PHP versions simultaneously
<?php $needle = bin2hex(random_bytes(15)); $shortString = $needle . bin2hex(random_bytes(20)); $longString = bin2hex(random_bytes(500)) . $needle . bin2hex(random_bytes(500)); for ($i = 0; $i < 100000; $i++) { 0 === strncmp($shortString, $needle, strlen($needle)); } for ($i = 0; $i < 100000; $i++) { 0 === strncmp($longString, $needle, strlen($needle)); }

preferences:
28.33 ms | 406 KiB | 5 Q