Date: 12/29/00
- Next message: jeremy brand: "Re: [PHP] PHP problems."
- Previous message: Jim Carey: "[PHP] Getting nameserver info"
- In reply to: Rob Curts: "[PHP] Creating a variable from a value"
- Next in thread: Kyle Jerviss: "Re: [PHP] Creating a variable from a value"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
What you want to do is called variable variables...
http://www.php.net/manual/language.variables.variable.php
you would do : $$myVar = "foo";
and then doing "echo $TEST" would return "foo"
-----Original Message-----
From: Rob Curts [mailto:rob <email protected>]
Sent: Thursday, December 28, 2000 21:54
To: php-general <email protected>
Subject: [PHP] Creating a variable from a value
This may seem strange... hopefully I can explain the problem well:
I have a variable named $myVar
$myVar contains a string that may look like anything, for example, we'll
use "TEST"
I want to take the string value of $myVar and make a variable out of it's
value.
A code example would be this:
<?
unset($TEST);
$myVar = "TEST";
createNewVariable($myVar);
if (isset($TEST)) {
// success
else
// error
?>
Any idea on how i would create this?
Many thanks in advance,
Rob
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe <email protected> For additional commands, e-mail: php-general-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>-- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe <email protected> For additional commands, e-mail: php-general-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: jeremy brand: "Re: [PHP] PHP problems."
- Previous message: Jim Carey: "[PHP] Getting nameserver info"
- In reply to: Rob Curts: "[PHP] Creating a variable from a value"
- Next in thread: Kyle Jerviss: "Re: [PHP] Creating a variable from a value"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

