Re: $name = "My $row['name']" not longer possible?
| From: | Hugo Wetterberg | Date: | Tue, 02 Jul 2002 17:11:39 +0000 |
| Subject: | Re: $name = "My $row['name']" not longer possible? | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-104967@lists.php.net to get a copy of this message | ||
It is possible to use arrays within strings, just skip ''.
Write
$name="My $name[name]";
instead
Hugo
"Matt Williams" <lists@yewlands.com> skrev i meddelandet
news:200207021345.g62DjCY03763@emanon.clcne.net...
> On Tuesday 02 July 2002 13:49, Uwe Birkenhain wrote:
>
> > Hi,
> > I upgraded to 4.2 and now I get those errormessages
> > "Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE,
expecting
> > T_STRING or T_VARIABLE or T_NUM_STRING in ..."
> >
> > when doing sth like:
> > $name = "My $row['name']";
> >
>
> Try
>
> $name = "My {$row['name']}";
>
> or
>
> $name = "My ".$row['name'];
>
> AFAIR you can't use array variables straight within strings.
>
> Maybe I'm just about to be proved wrong :)
>
> matt