If I wanted to trim say 20 characters from the right of a string, how would I do this??
Thank You!
Trim set number of characters
Moderator: General Moderators
Code: Select all
$string = substr($string, 0, strlen($string) - 20) // gets the string $string from the beginning to the end -20That's the same as:$phpNut wrote:Code: Select all
$string = substr($string, 0, strlen($string) - 20) // gets the string $string from the beginning to the end -20
Code: Select all
$string = substr($string, 0, -20);