Re: What did I do wrong to cause a parse error?
| From: | David Otton | Date: | Fri, 11 Jul 2003 06:48:13 +0000 |
| Subject: | Re: What did I do wrong to cause a parse error? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-154833@lists.php.net to get a copy of this message | ||
On Fri, 11 Jul 2003 00:53:32 -0400, you wrote:
>foreach ($profileArray[$i][attributes] as $key => $val) {
> $singleProfileHTML .= $key . "=\"" . str_replace("'",
> ''', str_replace('"', '"', $val)) .
> "\"\n";
> }
>
>The parsing error occurs in the "$singleProfileHTML.." line. I'm completely
>don't get it; I see absolutely nothing wrong with this, what did I miss?
Line 1 - attributes should have a $ in front of it, or be a string literal.
BTW, that's a really nasty line. Maybe it would be easier to read as :
foreach ($profileArray[$i][$attributes] as $key => $val) {
$val = str_replace('"', '"', $val);
$val = str_replace("'", ''', $val);
$singleProfileHTML .= "$key=\"$val\"\n";
}