note 17452 deleted from function.substr by jimw

From: Date: Thu, 20 Dec 2001 23:02:12 +0000
Subject: note 17452 deleted from function.substr by jimw
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-23531@lists.php.net to get a copy of this message
One things the docs for this function doesn't make clear is that if the $start >=0 and $length >= 0 and ( $start + $length ) > strlen( $str ), it will just return any characters it has and the string length will be less than $length. This can actually be quite handy as it allows you to use this function to set a maximum length for a string, eg: <br> $str = substr( $str, 0, 10 ) // This forces $str to be a max of 10 chars

« previous php.notes (#23531) next »