3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function strpose($haystack, $needle, $offset = 0) { $found = preg_match( '(\b(?:'.preg_quote($needle).')\b)Su', $haystack, $match, PREG_OFFSET_CAPTURE, $offset ); return ($found) ? $match[0][1] : FALSE; } var_dump(strpose("Hello World", "ll")); var_dump(strpose("Hello World", "Hello")); var_dump(strpose("Hello Worlds", "World")); var_dump(strpose("Hello World", "World")); var_dump(strpose("Hello World", "Hello World"));
Output for 4.3.3 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
bool(false) int(0) bool(false) int(6) int(0)
Output for 4.3.0 - 4.3.2
Warning: Wrong parameter count for preg_match() in /in/b0BIZ on line 10 bool(false) Warning: Wrong parameter count for preg_match() in /in/b0BIZ on line 10 bool(false) Warning: Wrong parameter count for preg_match() in /in/b0BIZ on line 10 bool(false) Warning: Wrong parameter count for preg_match() in /in/b0BIZ on line 10 bool(false) Warning: Wrong parameter count for preg_match() in /in/b0BIZ on line 10 bool(false)