RE: [PHP-DEV] Bug #11512: Parsing of vars inside a string

From: Date: Tue, 19 Jun 2001 03:10:40 +0000
Subject: RE: [PHP-DEV] Bug #11512: Parsing of vars inside a string
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-56972@lists.php.net to get a copy of this message
I think the problem here is that $varone_foo is the valid form of a variable.... so: $vartwo="$varone_foo"; is getting parsed as a single variable called $varone_foo PHP is *smart* enough to know that foo_$varone is not a valid name for a variable or constant, and it goes out of its way to implicitly treat it like: $vartwo="foo_".$varone instead of $vartwo="foo_$varone"; You mentioned that in your example, $vartwo is not "blah_foo" as expected... if you cranked your error reporting, you'll probably get an error like "$varone_foo is not a valid variable" -Brian Tanner $varone="blah"; $vartwo="$varone_foo"; => The resulting contents of $vartwo is not "blah_foo" as expected. You can only get the desired result by having $vartwo= $varone . "_foo"; However something like $vartwo="foo_$varone" works as expected => "foo_blah"; Is this a language construct issue perhaps? -- Edit Bug report at: http://bugs.php.net/?id=11512&edit=1 -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe@lists.php.net For additional commands, e-mail: php-dev-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.dev (#56972) next »