- substr: documentation ( source)
- strpos: documentation ( source)
- preg_replace: documentation ( source)
<?php
// Positive numbers:
$res5[0][0]="tag1,tag10,tag11,tag13,tag15,tag17,tag19,tag20,tag4,tag9,tag8,tag7,tag6,tag5,tag3,tag2,tag18,tag16,tag14,tag12";
if (strpos($res5[0][0], 'tag') !== false)
{
$str1=substr($res5[0][0],0,3);
$str2=preg_replace("/tag/","",substr($res5[0][0],3));
echo $str1.$str2;
}
?>