3v4l.org

run code in 300+ PHP versions simultaneously
<?PHP $paths = [ '.*/cars$', '^cars/.*/', '/trucks$', '.*/trucks$' ]; $url = 'some-site.com/cars'; foreach($paths AS $v) { if (preg_match('~'.$v.'~', $url, $out)) { echo $v.' matched this part of $url: '.$out[0]; break; } } ?>

preferences:
24.44 ms | 404 KiB | 5 Q