note 60971 deleted from language.types.string by felipe
| From: | felipe@php.net | Date: | Sun, 23 Mar 2008 23:14:28 +0000 |
| Subject: | note 60971 deleted from language.types.string by felipe | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-137439@lists.php.net to get a copy of this message | ||
Note Submitter: adam at obledesign dot com
----
If you really want to get constants inside your string you can do something like this (PHP5 only).
<?php
class GetConstant {
public function __get($constant_name) {
return (defined($constant_name) ? constant($constant_name) : NULL);
}
}
$C = new GetConstant();
define('FOO','bar');
echo("I want a candy {$C->FOO}.");
?>