Re: function by reference

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, 2006-04-09 at 14:17, tedd wrote:
> Hi gang:
> 
> Not that I have an immediate need for this, but in other languages 
> one can access a function by reference (in other words, it's address 
> -- such as call(function address) ).
> 
> In php, one can pass a variable by reference by simply using the 
> ampersand, such a &$a.
> 
> Is there a similar way to reference a function?
> 
> Rob, was kind enough to post the following code, but I was looking 
> for something where I could store the function's address in a 
> variable. Something like:
> 
> $a = &f_a();
> 
> And then, where I could use call_user_func($a); (or something 
> similar) and the function would do it's thing -- anything like that?

It's the same thing for the most part...

<?php

$a = 'f_a';
call_user_func( $a, $p1, $p2, $p3 )

?>

Cheers,
Rob.
-- 
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for       |
| creating re-usable components quickly and easily.          |
`------------------------------------------------------------'

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux