RE: [PHP] constant from variable
| From: | Adam Petrone | Date: | Fri, 04 Jun 2010 19:15:00 +0000 |
| Subject: | RE: [PHP] constant from variable | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-305832@lists.php.net to get a copy of this message | ||
Use the constant() function:
echo constant( $my . $const );
http://www.php.net/manual/en/function.constant.php
-----Original Message-----
From: Tanel Tammik [mailto:keevitaja@gmail.com]
Sent: Friday, June 04, 2010 3:08 PM
To: php-general@lists.php.net
Subject: [PHP] constant from variable
Hi,
define('MYCONST', 'something');
$my = 'my';
$const = 'const';
is it possible to get the value of MYCONST using variables $my and
$const_
Br
Tanel
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php