smart_explode() :
function smart_explode ($exploder, $string, $sort = '') {
if (trim ($string) != '') {
$string = explode ($exploder, $string);
foreach ($string as $i => $k) {
$string[$i] = trim ($k);
if ($k == '') unset ($string[$i]);
}
$u = array_unique ($string);
if ('sort' == $sort) sort ($u);
return $u;
} else {
return array ();
}
}
$ , $exploder ( ), , , $sort "sort". , $.
:
$mytaglist = smart_explode (',', ' PHP, ,,regEx ,PHP');
:
array ('PHP', 'regEx')
, ,
$mytaglist = str_replace (array ('?', '$', '%'), '_', $mytaglist);
smart_exploding ( "" ).