3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = 'this is test'; preg_match('/(?P<test>\w+)/', $string, $matches); // basic syntax var_dump($matches['test']); preg_match('/(?<test>.+)/', $string, $matches); // alternative var_dump($matches['test']); preg_match("/(?'test'.+)/", $string, $matches); // alternative var_dump($matches['test']);

preferences:
27.51 ms | 402 KiB | 5 Q