3v4l.org

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

preferences:
131.76 ms | 405 KiB | 5 Q