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:
pezcurrel 2024-10-26 23:07:43 +02:00
parent fb8e15dbc6
commit 6751e11e69

View file

@ -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;