note 58632 modified in language.variables by danbrown
| From: | danbrown@php.net | Date: | Sun, 20 Jul 2008 16:02:15 +0000 |
| Subject: | note 58632 modified in language.variables by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-142150@lists.php.net to get a copy of this message | ||
When using variable variables this is invalid:
<?php
$my_variable_{$type}_name = true;
?>
to get around this do something like:
<?php
$n="my_variable_{$type}_name";
${$n} = true;
?>
(or $$n - I tend to use curly brackets out of habit as it helps t reduce bugs ...)
--was--
When using variable variables this is invalid:
$my_variable_{$type}_name = true;
to get around this do something like:
$n="my_variable_{$type}_name";
${$n} = true;
(or $$n - I tend to use curly brackets out of habit as it helps t reduce bugs ...)
http://php.net/manual/en/language.variables.php