|
Posted by Adam on 11/24/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]
|