note 46118 rejected from function.substr by tomsommer
| From: | tomsommer@php.net | Date: | Wed, 29 Sep 2004 23:16:10 +0000 |
| Subject: | note 46118 rejected from function.substr by tomsommer | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-77593@lists.php.net to get a copy of this message | ||
Note Submitter: patrick dot ogren at twc dot state dot tx dot us
----
Is there any reason that this won't work?
$test = "abcdefghijklmnop";
$var[0] = substr($test,4,8);
$var[1] = substr_replace($test,********,4,8);
print_r($var);
Using PHP 4.3.1, the results of $var are [0] = a, [1] = e
Weird.
The way around it is:
$var = array(0 => (substr($test,4,8)), 1=> (substr_replace($test,********,4,8)));
Which gives proper results.
Is this a current bug, or am I missing something obvious?