Now it first discards possible “non-word” characters at beginning and end of line, and splits by any number of them
This commit is contained in:
parent
fb8e15dbc6
commit
6751e11e69
1 changed files with 2 additions and 1 deletions
|
@ -1,7 +1,8 @@
|
|||
<?php
|
||||
|
||||
function hashtag($str,$ucfirst=true) {
|
||||
$str=preg_split('#\W#u',$str);
|
||||
$str=preg_replace('#^\W*(.*)\W*$#','$1',$str);
|
||||
$str=preg_split('#\W+#u',$str);
|
||||
$c=count($str);
|
||||
if ($c>1) {
|
||||
($ucfirst) ? $beg=0 : $beg=1;
|
||||
|
|
Loading…
Reference in a new issue