Re: Array pointer to a function

From: Date: Tue, 08 Apr 2008 04:58:26 +0000
Subject: Re: Array pointer to a function
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-272683@lists.php.net to get a copy of this message
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

« previous php.general (#272683) next »