Re: Variable in variable.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 10-08-26 09:54 AM, João Cândido de Souza Neto wrote:
I know that in PHP I can use this:

$var1 = "text";
$var2 = '$var1';
4cho $$var2;

So it gives me "text".

It would if you didn't have typos and the wrong quotes in the above :)

My question is, is there a way of doing it with constant like this?

define("CONST", "text");
$test = "CONST";
echo $$test;

So it gives me "text".

http://ca3.php.net/manual/en/function.constant.php

Cheers,
Rob.
--
E-Mail Disclaimer: Information contained in this message and any
attached documents is considered confidential and legally protected.
This message is intended solely for the addressee(s). Disclosure,
copying, and distribution are prohibited unless authorized.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux