Dave Avent wrote:
>       function showvar($var) {
>
>               foreach($GLOBALS as $key => $value) {
>                       if($value == $var) {
>                               $varname = $key;
>                       }
>               }

The problem with the above is that it assumes that there will never be more than one
global variable that contains the same value, and will give incorrect output in this
case:

$s1 = "Hello World";
...
$s2 = "Hello World";
...
showvar($s1);

Also it's probably a better idea to have the "showvar" function use print_r() or
var_export() in case it is passed something other than a scalar.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to