RE: [PHP] $name = "My $row['name']" not longer possible?
> -Original Message- > From: Hugo Wetterberg [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, July 02, 2002 1:12 PM > To: [EMAIL PROTECTED] > Subject: Re: [PHP] $name = "My $row['name']" not longer possible? > It is possible to use arrays within strings, just skip ''. > Write > $name="My $name[name]"; > instead Yes, but the manual says that's a feature that may not exist in future versions of php. See this link for details: http://www.php.net/manual/en/language.types.array.php#language.types.array.foo-bar -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $name = "My $row['name']" not longer possible?
Hallo Matt, thank you for the explanation and for the manual-link! But - correct if I'm wrong - that has been possible before! Or not? Uwe Matt Schroebel schrieb in Nachricht <4B08FD7DB3CBD4119F560002A508C453015B3851@hsus3>... >> "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']"; > >You have to wrap array references in curly braces within double quoted strings. Proper form is: >$name = "My {$row['name']}"; > >See: http://www.php.net/manual/en/language.types.string.php#language.types.string .parsing.complex -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $name = "My $row['name']" not longer possible?
It is possible to use arrays within strings, just skip ''. Write $name="My $name[name]"; instead Hugo "Matt Williams" <[EMAIL PROTECTED]> skrev i meddelandet [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $name = "My $row['name']" not longer possible?
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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] $name = "My $row['name']" not longer possible?
> "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']"; You have to wrap array references in curly braces within double quoted strings. Proper form is: $name = "My {$row['name']}"; See: http://www.php.net/manual/en/language.types.string.php#language.types.string.parsing.complex -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php