3v4l.org

run code in 300+ PHP versions simultaneously
<?php $re = '%^ ((?=x))? ((?=y))? (\w) $%mx'; $str = 'x y z'; preg_match_all($re, $str, $matches, PREG_SET_ORDER | PREG_UNMATCHED_AS_NULL, 0); // Print the entire match result var_dump($matches);

preferences:
57.86 ms | 402 KiB | 5 Q