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 < 10000; $i++) { 0 === strncmp($shortString, $needle, strlen($needle)); } for ($i = 0; $i < 10000; $i++) { 0 === strncmp($longString, $needle, strlen($needle)); }

preferences:
24.82 ms | 402 KiB | 5 Q