bebop_aria wrote in php 😡annoyed

Truncating a string

This feels like it's a dim question that I should know the answer to, but I'm striking out.

Have looked in my trusty books but so far have not found the answer.

I obtain a string from an operation as a variable, and if the string is longer than 8 characters, I want to truncate the string to 7 characters (and append a character if the string has been truncated). I know how to append it, but need to know how to truncate all characters after the 7th before doing so.

(I've been lurking and soaking up for a while now, and want to say thanks in arrears and advance to all of you bright minds in the php community!)