3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php preg_match('^catalog\\/[a-zA-Z0-9_\-\.]\\/.*$', 'catalog/bisque/mayco/samples/mayco_mb1211_0.jpg', $matches); $directory = $matches[0] ?? ''; var_dump($directory);
based on JEaKf
Output for 7.0.0 - 7.3.0rc3
Warning: preg_match(): No ending delimiter '^' found in /in/WsKjD on line 3 string(0) ""
Output for hhvm-3.12.14 - 3.17.3
Warning: No ending delimiter '^' found: [^catalog\/[a-zA-Z0-9_\-\.]\/.*$] in /in/WsKjD on line 3 string(0) ""
Output for 5.6.0 - 5.6.30
Parse error: syntax error, unexpected '?' in /in/WsKjD on line 5
Process exited with code 255.