hi everyone, I have a problem converting my links text to only 20 characters. i need this code: $vidname = '<a href="'.$link.'single.php?id='.$id.'">'.$title.'</a>'; echo $vidname; PHP: to automaically convert its links to only 20 characters. So if a a link is "abcdefghijklmnopqrstuvw" it will automatically be "abcdefghijklmnopqrst". I've tried if (strlen($vidname['title'])>20) { echo "...";} PHP: but still no hope. Please help Thanks, SP360
if (strlen($vidname['title'])>20) { $vidname['title'] = substr($vidname['title'],0,20).'...'; } //However, I think you should be doing the editing to $title, not $vidname['title'], unless it is the value of $title. if (strlen($title)>20) { $title = substr($title,0,20).'...'; } $vidname = '<a href="'.$link.'single.php?id='.$id.'">'.$title.'</a>'; echo $vidname; PHP: Peace,