3v4l.org

run code in 300+ PHP versions simultaneously
<?php $time = microtime(true); for ($i = 0; $i < 10000; $i++) { $array = array(); $str = '|' . implode('|', array_keys($_SERVER)); do { if (false !== $pos = strpos($str, '|SCRIPT_')) { if (false !== $pos2 = strpos($str, '|', $pos + 1)) { $array[] = substr($str, $pos + 1, $pos2 - $pos - 1); $str = substr($str, $pos2); } else { $array[] = substr($str, $pos + 1); $str = ''; } } } while ($pos !== false && $str); } var_dump($array, microtime(true) - $time);

preferences:
37.17 ms | 402 KiB | 5 Q