Re: What did I do wrong to cause a parse error?
| From: | Phil Powell | Date: | Fri, 11 Jul 2003 06:50:27 +0000 |
| Subject: | Re: What did I do wrong to cause a parse error? | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-154836@lists.php.net to get a copy of this message | ||
Thanx I got it to work, however, I have no idea why it works now considering
I did nothing different:
$singleProfileHTML .= "<!--\n";
foreach ($profileArray[$i][attributes] as $key => $val) {
$singleProfileHTML .= strtolower($key) . '="' . str_replace("'",
''', str_replace('"', '"', stripslashes($val)))
. "\"\n";
}
$singleProfileHTML .= "-->\n";
Beats the heck out of me!
Phil
----- Original Message -----
From: "David Otton" <phpmail@jawbone.freeserve.co.uk>
To: "Phil Powell" <soazine@erols.com>
Cc: <php-general@lists.php.net>
Sent: Friday, July 11, 2003 2:48 AM
Subject: Re: [PHP] What did I do wrong to cause a parse error?
> 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";
> }
>