Re: name of the variable
| From: | Ólafur Waage | Date: | Fri, 09 Mar 2007 09:36:19 +0000 |
| Subject: | Re: name of the variable | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-250160@lists.php.net to get a copy of this message | ||
I found this on the zend forums. Hope it helps.
function Dump($var) {
if (key_exists($var, $GLOBALS)) {
echo "<pre>$$var:\n";
var_dump($GLOBALS[$var]);
echo "\n</pre>\n";
}
else
echo "<span class='error'>No variables named <em>$$var</em>!</span>\n";
}
- Ólafur W
2007/3/9, Cefull Lo <cefull@gmail.com>:
Hi everyone, Is there any function that return the name of the variable?? i.e. $foo='abc'; $bar=somefunc($foo); // $bar='foo' here Thanks -- -----BEGIN GEEK CODE BLOCK----- Version: 3.1 GSC d- s:>++ a- C++ UL/B+++$ !P L++>+++++ E--- W+ N o-- K? w++ O? M- V- PS PE++(-) Y+ PGP++@ t 5 X R+>+++$ tv- b+++ DI++ D++ G++@ e+++>+++++ h*>--- r-- z? -----END GEEK CODE BLOCK------