note 4643 modified in stristr by ronabop
| From: | ronabop@php.net | Date: | Sun, 05 Nov 2000 04:37:01 +0000 |
| Subject: | note 4643 modified in stristr by ronabop | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-7393@lists.php.net to get a copy of this message | ||
In the same line as the comments above - be careful in code near a stristr call. It seems that php
tries to reuse variables where possible so that in a code snippit like:
$temp = $variable;
$output = stristr ($something, $variable);
The variable $temp is converted to lowercase as well as $variable. (Just two pointers to the same
location I guess). A workaround is to make the assignment line:
$temp = $variable."";
or even shorten the code to:
$output = stristr($something, $variable."");
http://www.php.net/manual/function.stristr.php