- print_r: documentation ( source)
- preg_replace: documentation ( source)
- preg_filter: documentation ( source)
<?php
$var = array(
'#tag',
'text #tag text',
'text #tag',
'text#tag',
);
$res = preg_filter('/\B#(\S{1,24}+)/u', '#<$1>' , $var);
print_r($res);
echo preg_replace('/#(\S{1,24}+)/u', '#<$1>' , 'text#tag');