<?php $arr = array( 'news', 'news?test=1', 'news/list?test=1', ); $res = array(); foreach($arr as $m) { preg_match('/(\w)+[\?\/]?/', $m, $res); print_r($res); }
You have javascript disabled. You will not be able to edit any code.