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:
22.41 ms | 475 KiB | 4 Q