3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function strpos_array($haystack, $needles) { if ( is_array($needles) ) { foreach ($needles as $str) { if ( is_array($str) ) { $pos = strpos_array($haystack, $str); } else { $pos = strpos($haystack, $str); } if ($pos !== FALSE) { return $pos; } } } else { return strpos($haystack, $needles); } } // Test echo strpos_array('This is a test', array('test', 'drive')); // Output is 10
based on eY3KN
Output for 4.3.0 - 5.0.5, 5.1.1 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
10
Output for 5.1.0
Fatal error: fatal flex scanner internal error--end of buffer missed in /in/IQR76 on line 21
Process exited with code 255.