RE: [PHP] inserting a variable into a variable
why don't you do something like $var = $foo $baa; ? -Original Message- From: Hasan Niyaz [mailto:[EMAIL PROTECTED]] Sent: Wednesday, June 20, 2001 12:07 PM To: [EMAIL PROTECTED] Subject: [PHP] inserting a variable into a variable Hello all, I have come to a situation where i am having a variable inside another variable. for example. $rm_$cat_adt The above is a variable and $cat is again another variable This does not work.. Need some help! Thanks, Hasan
Re: [PHP] inserting a variable into a variable
I have come to a situation where i am having a variable inside another variable. for example. $rm_$cat_adt This works for me: ? $cat=def; ${abc_.$cat._ghi}=TEST; echo 'abc_.$cat._ghi = '.${abc_.$cat._ghi}.br\n; echo 'abc_def_ghi = '.$abc_def_ghi.br\n; ? michi -- GMX - Die Kommunikationsplattform im Internet. http://www.gmx.net -- GMX Tipp: Machen Sie Ihr Hobby zu Geld bei unserem Partner 11! http://profiseller.de/info/index.php3?ac=OM.PS.PS003K00596T0409a
RE: [PHP] inserting a variable into a variable
What on earth are you trying to do? :) I'm not sure what your getting at, do you mean defining a variable based on another variables name? Perhaps try using an array, and specifying $rm($cat) Sorry, im not too sure what you mean Ray Hilton - [EMAIL PROTECTED] http://rayh.co.uk -Original Message- From: Hasan Niyaz [mailto:[EMAIL PROTECTED]] Sent: 20 June 2001 04:07 To: [EMAIL PROTECTED] Subject: [PHP] inserting a variable into a variable Hello all, I have come to a situation where i am having a variable inside another variable. for example. $rm_$cat_adt The above is a variable and $cat is again another variable This does not work.. Need some help! Thanks, Hasan
Re: [PHP] inserting a variable into a variable
I have come to a situation where i am having a variable inside another variable. for example. $rm_$cat_adt PHP would read this as trying to prepend the variable $cat_adt to the variable $rm_ You seem to be trying to insert the variable $cat into the middle of a variable.. possible, but probably better to slightly rethink your naming strategy HTH, Tom The above is a variable and $cat is again another variable This does not work.. Need some help! Thanks, Hasan
Re: [PHP] inserting a variable into a variable
Michi, Yours did the trick... thank you and everyone else who contributed. Hasan - Original Message - From: [EMAIL PROTECTED] To: Hasan Niyaz [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Wednesday, June 20, 2001 11:46 AM Subject: Re: [PHP] inserting a variable into a variable I have come to a situation where I am having a variable inside another variable. for example. $rm_$cat_adt This works for me: ? $cat=def; ${abc_.$cat._ghi}=TEST; echo 'abc_.$cat._ghi = '.${abc_.$cat._ghi}.br\n; echo 'abc_def_ghi = '.$abc_def_ghi.br\n; ? michi -- GMX - Die Kommunikationsplattform im Internet. http://www.gmx.net -- GMX Tipp: Machen Sie Ihr Hobby zu Geld bei unserem Partner 11! http://profiseller.de/info/index.php3?ac=OM.PS.PS003K00596T0409a -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] inserting a variable into a variable
you so totally could use an assoc. array right now: $cat_adt = x; $rm = y; $a[ $cat_adt ] = whatever; $a[ $rm.$cat_adt ] = Yeah; print $a['yx']; save yourself a lot of trouble and dont bother with variables-of-variables and trying to get $rm_$cat_adt == $rm_x just use a hash... that's what it's there for ;) -Original Message- From: Tom Carter [mailto:[EMAIL PROTECTED]] Sent: Wednesday, June 20, 2001 5:24 AM To: Hasan Niyaz; [EMAIL PROTECTED] Subject: Re: [PHP] inserting a variable into a variable I have come to a situation where i am having a variable inside another variable. for example. $rm_$cat_adt PHP would read this as trying to prepend the variable $cat_adt to the variable $rm_ You seem to be trying to insert the variable $cat into the middle of a variable.. possible, but probably better to slightly rethink your naming strategy HTH, Tom The above is a variable and $cat is again another variable This does not work.. Need some help! Thanks, Hasan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] inserting a variable into a variable
Or, you could do... $cat = 'butch'; ${rm_{$cat}_adt} = 'is cool'; // This would set the variable $rm_butch_adt equal to 'is cool' -js - Original Message - From: scott [gts] [EMAIL PROTECTED] To: php [EMAIL PROTECTED] Sent: Wednesday, June 20, 2001 8:37 AM Subject: RE: [PHP] inserting a variable into a variable you so totally could use an assoc. array right now: $cat_adt = x; $rm = y; $a[ $cat_adt ] = whatever; $a[ $rm.$cat_adt ] = Yeah; print $a['yx']; save yourself a lot of trouble and dont bother with variables-of-variables and trying to get $rm_$cat_adt == $rm_x just use a hash... that's what it's there for ;) -Original Message- From: Tom Carter [mailto:[EMAIL PROTECTED]] Sent: Wednesday, June 20, 2001 5:24 AM To: Hasan Niyaz; [EMAIL PROTECTED] Subject: Re: [PHP] inserting a variable into a variable I have come to a situation where i am having a variable inside another variable. for example. $rm_$cat_adt PHP would read this as trying to prepend the variable $cat_adt to the variable $rm_ You seem to be trying to insert the variable $cat into the middle of a variable.. possible, but probably better to slightly rethink your naming strategy HTH, Tom The above is a variable and $cat is again another variable This does not work.. Need some help! Thanks, Hasan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]