Re: Globals or Super Global Variables To Be Reused from For Loops
| From: | Bastien Koert | Date: | Thu, 06 Nov 2008 15:22:44 +0000 |
| Subject: | Re: Globals or Super Global Variables To Be Reused from For Loops | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-282993@lists.php.net to get a copy of this message | ||
[snip]
[/snip]
Alice,
The big problem here is that you are resetting the $string3 variable in the
loop
for ($j=0; $j<$count_chunk2; $j++) {
$string3= $stringChunk2[$j]; // <<<------ resetting
the value
if ($j <$count_chunk_2) {
$string2= " OR ";
$string3=$string3.$string2;
}
else {
//Don't do anything
}
echo $string3;
}
I am not sure of your goal since you have not stated it, but it certainly
should be easier to just replace the PIPE with the OR
$message = str_replace("|", " OR ", $message);
--
Bastien
Cat, the other other white meat