You are here: Re: Get name of passed variable in a function « PHP Programming Language « IT news, forums, messages
Re: Get name of passed variable in a function

Posted by Adam on 09/29/02 11:28

On 3 Oct 2005 22:32:04 -0700, Chung Leong wrote:

>See the following thread:
>http://groups.google.com/group/comp.lang.php/browse_frm/thread/5055003f44ae6ee4/35697d72cf31b316

Chung - thank you for that! I had to do the array_shift tweak as I
tend to use include files.

For the benefit of readers here, I've pasted your code (with my tweak
and thanks):

function bobo_the_clown($b) {
$bt = debug_backtrace();
extract(array_shift($bt));
$lines = file($file);
$code = implode('', array_slice($lines, $line - 1));
preg_match('/\bbobo_the_clown\s*\(\s*(\S*?)\s*\)/i', $code,
$matches);
return @$matches[1] . " : " . $b;
}

$a = "Hello";
echo bobo_the_clown($a);

Now, if only I could understand how it works .. LOL. Still so much to
learn!

Adam.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация