Trim set number of characters
Posted: Sat May 13, 2006 7:36 am
If I wanted to trim say 20 characters from the right of a string, how would I do this??
Thank You!
Thank You!
A community of PHP developers offering assistance, advice, discussion, and friendship.
http://forums.devnetwork.net/
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);