note 24306 added to function.substr
| From: | null at null dot com | Date: | Mon, 12 Aug 2002 20:25:25 +0000 |
| Subject: | note 24306 added to function.substr | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-34895@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'.
:-)
--
http://www.php.net/manual/en/function.substr.php
http://master.php.net/manage/user-notes.php?action=edit+24306
http://master.php.net/manage/user-notes.php?action=delete+24306
http://master.php.net/manage/user-notes.php?action=reject+24306