3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $pattern = "#^/([a-z]{2})/([a-zA-Z0-9_-]++)/([a-zA-Z0-9_-]++)/(.*/)?+[/]{0,1}$#"; $pattern = "#^/([a-z]{2})/([a-zA-Z0-9_-]++)/([a-zA-Z0-9_-]++)((/.*+)?+)+/$#g"; $subject = '/en/user/login/foo/bar/'; var_dump(preg_match($pattern, $subject, $matches), $matches); $subject = '/en/user/login'; var_dump(preg_match($pattern, $subject, $matches), $matches);
Output for 5.2.0 - 7.2.0
Warning: preg_match(): Unknown modifier 'g' in /in/4Nsqk on line 6 bool(false) NULL Warning: preg_match(): Unknown modifier 'g' in /in/4Nsqk on line 9 bool(false) NULL
Output for 4.3.11 - 5.1.6
Warning: preg_match(): Unknown modifier 'g' in /in/4Nsqk on line 6 bool(false) array(0) { } Warning: preg_match(): Unknown modifier 'g' in /in/4Nsqk on line 9 bool(false) array(0) { }
Output for 4.3.0 - 4.3.10
Warning: Unknown modifier 'g' in /in/4Nsqk on line 6 bool(false) array(0) { } Warning: Unknown modifier 'g' in /in/4Nsqk on line 9 bool(false) array(0) { }