make a variable only 19 character long?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
jasondavis
Forum Commoner
Posts: 60
Joined: Sat Feb 04, 2006 5:35 pm

make a variable only 19 character long?

Post by jasondavis »

Ok I got

Code: Select all

$decrypted = mb_substr($decrypted, 0, 19);
this trims my variablke to 19 characters, how can I make it show the 19 characters then "..." but only show if it is over 19 characters?
Roja
Tutorials Group
Posts: 2692
Joined: Sun Jan 04, 2004 10:30 pm

Post by Roja »

Code: Select all

if (mb_strlen($decrypted) > 19) { $decrypted .= '...'; }
Post Reply