3v4l.org

run code in 500+ PHP versions simultaneously
<?php $string = 'bar'; $matches = []; preg_match('~(?|foo(*:1) |bar(*:2) |baz(*:3))~x', $string, $matches); var_dump($matches);

preferences:
58.07 ms | 1487 KiB | 5 Q