note 24306 deleted from function.substr by victor

From: Date: Wed, 02 Oct 2002 10:44:16 +0000
Subject: note 24306 deleted from function.substr by victor
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-37532@lists.php.net to get a copy of this message
Some people might prefer using the function similar to this: substr(string, start, end); rather than: substr(string, start, size); (I didn't RTFM and assumed it was the first way) Anyway, if you want to, try this: function substr_alt($string, $start, $end) { substr($string, $start, $end-$start); } Then you could use substr_alt("abcdef", 2, 4); which would return 'cd'. :-)

« previous php.notes (#37532) next »