3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $arr = array( 'new_s1', 'new_s?test=1', 'news/list?test=1', ); $res = array(); foreach($arr as $m) { preg_match('/(\w+)[\?\/]?/', $m, $res); print_r($res); }
Output for 4.3.0 - 7.1.0
Array ( [0] => new_s1 [1] => new_s1 ) Array ( [0] => new_s? [1] => new_s ) Array ( [0] => news/ [1] => news )