note 48627 deleted from function.get-defined-constants by tularis
| From: | tularis@php.net | Date: | Sun, 02 Jan 2005 18:05:35 +0000 |
| Subject: | note 48627 deleted from function.get-defined-constants by tularis | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-82605@lists.php.net to get a copy of this message | ||
Note Submitter: Steve
----
This function is very usefull if you want to expand constant
values in a string especially when using heredoc syntax.
It's easy like that
<?php
define ('cNAME', 'Peter');
define ('cPLACE', 'Sydney');
$constants = get_defined_constants();
$text = <<< EOT
Hi {$constants['cNAME']}
have you ever been in {$constants['cPLACE']}?
EOT;
echo $text;
?>
----
Reason: useless example