Re: Array pointer to a function

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

 



On Tue, 2008-04-08 at 14:00 +1000, hce wrote:
> Hi,
> 
> Is it possible for an array to point a function:
> 
> Asignmanet
> 
> $ArrayPointer = $this->MyFunction;
> 
> Invoke:
> 
> $ArraryPointer();

No, you can't do what you've done above. What you can do is...

<?php

    $ptr = array( 'obj' => &$this, 'method' => 'MyFunction' );
    $ptr['obj']->$ptr['method']();

?>

Cheers,
Rob.
-- 
http://www.interjinn.com
Application and Templating Framework for PHP


-- 
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