3v4l.org

run code in 500+ PHP versions simultaneously
<?php function get_found_strings(string $haystack, array $needles): array { $regex = '/' . str_replace('\|', '|', preg_quote(implode('|', $needles))) . '/'; preg_match_all($regex, $haystack, $matches); return $matches[0]; } $string1 = "Example! Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed tortor ipsum, faucibus iaculis dapibus ut, mollis vel diam."; $array_to_find = [ "#Example", "Example!", "Example?" ]; var_dump(get_found_strings($string1, $array_to_find));
Output for rfc.property-hooks, git.master, git.master_jit
array(1) { [0]=> string(8) "Example!" }

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
42.86 ms | 861 KiB | 4 Q