note 90302 modified in function.substr by danbrown
| From: | danbrown@php.net | Date: | Wed, 15 Apr 2009 17:20:15 +0000 |
| Subject: | note 90302 modified in function.substr by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-153344@lists.php.net to get a copy of this message | ||
If you need to get the first $num Chars of $str and remove them from $str you'll want to use
following function:
<?php
function string_shift(&$str,$num) {
$cutOff=substr($str,0,$num);
$str=substr($str,$num);
return $cutOff;
}
?>
--was--
If you need to get the first $num Chars of $str and remove them from $str you'll want to use
following function:
function string_shift(&$str,$num) {
$cutOff=substr($str,0,$num);
$str=substr($str,$num):
return $cutOff;
}
http://php.net/manual/en/function.substr.php