Hello,

After some "intense" searching of Google I found one example at
http://us2.php.net/language.variables on how to get the name of a
variable. But it looks pretty expensive.

<?php
  function vname(&$var, $scope=false, $prefix='unique', $suffix='value')
  {
   if($scope) $vals = $scope;
   else      $vals = $GLOBALS;
   $old = $var;
   $var = $new = $prefix.rand().$suffix;
   $vname = FALSE;
   foreach($vals as $key => $val) {
     if($val === $new) $vname = $key;
   }
   $var = $old;
   return $vname;
  }
?>

Anyone aware of a simple language construct(?) that can do this? I'm on
PHP 4.3.9.



Thanks,
Chris.

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

Reply via email to