| | |
Name variable after other variable
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
•
•
Join Date: May 2008
Posts: 254
Reputation:
Solved Threads: 20
Is there any way to name a variable after another variable, I sort of made up this bit of code which I thought might work but it didn't
Bit of a long shot I know but I thought it might work,
Any other ideas, I wondered if there was a command like setvariable(); where you could set the variable name as a string but I couldnt find anything.
Regards,
Sam Rudge
PHP Syntax (Toggle Plain Text)
<php $V_Name = 'variable'; $"$V_Name" = 'Hello'; print($variable); ?>
Any other ideas, I wondered if there was a command like setvariable(); where you could set the variable name as a string but I couldnt find anything.
Regards,
Sam Rudge
My Blog, Life and everything that matters to me - SamRudge.co.uk
2x Macbook Pro's, 1x Mac Pro, 1x iMac, 2x Macbook's running Fedora linux - In conclusion, I hate windows =)
2x Macbook Pro's, 1x Mac Pro, 1x iMac, 2x Macbook's running Fedora linux - In conclusion, I hate windows =)
You can use something called a variable variable(yeah, I know it's weird)
php Syntax (Toggle Plain Text)
$variable="name"; $$variable = "Shawn"; echo $name; // prints Shawn
GCS d- s+ a-->? C++(++++) UL+++ P+>+++ L+++ E--- W+++
N+ o K w++(---) O? !M- V PS+>++ PE+ Y+ PGP !t- 5? X- R tv+
b+>++ DI+ D G++>+++ e+ h+>++ r y+
PMs asking for help will not be answered, post on the forums. That's what they're there for.
N+ o K w++(---) O? !M- V PS+>++ PE+ Y+ PGP !t- 5? X- R tv+
b+>++ DI+ D G++>+++ e+ h+>++ r y+
PMs asking for help will not be answered, post on the forums. That's what they're there for.
•
•
Join Date: May 2008
Posts: 254
Reputation:
Solved Threads: 20
Thanks, That worked fine
My Blog, Life and everything that matters to me - SamRudge.co.uk
2x Macbook Pro's, 1x Mac Pro, 1x iMac, 2x Macbook's running Fedora linux - In conclusion, I hate windows =)
2x Macbook Pro's, 1x Mac Pro, 1x iMac, 2x Macbook's running Fedora linux - In conclusion, I hate windows =)
![]() |
Similar Threads
- help!! how do you save a variable to a... (C++)
- Variable Variable Names (C)
- Accessing a variable of another class (Java)
Other Threads in the PHP Forum
- Previous Thread: Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource
- Next Thread: Zend is making me feel Zendy!!
| Thread Tools | Search this Thread |
.htaccess ajax apache api array back basic beginner binary broken cakephp checkbox class cms code computing cron curl customizableitems database date delete display dynamic echo email error file files filter folder form forms function functions gc_maxlifetime google host href htaccess html image include insert integration ip java javascript joomla limit link login loop mail memmory memory menu mlm mod_rewrite multiple mysql navigation oop parsing paypal pdf php problem query radio random recursion regex remote script search server sessions sms snippet soap source space sql syntax system table thesishelp trouble tutorial update upload url validation validator variable video web xml youtube






