note 10200 added to Variable functions
| From: | antoine at ws-interactive dot fr | Date: | Tue, 19 Dec 2000 10:30:12 +0000 |
| Subject: | note 10200 added to Variable functions | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-8897@lists.php.net to get a copy of this message | ||
Re: Variable functions and classes
The kcavness@proxicom.com method don't work (parse error of course). The php@timewarp.org
method works, but the variable function must exist in the class. If you want inside a class have a
var storing the name of a generic function (like mysql_connect in a class of db connection that you
can later port to Oracle in a breeze), you got to store the name in an array :
$this->funcs = array()
$this->funcs["connect] = "mysql_connect" ;
$this->funcs["select"] = "mysql_select_db" ;
...
Then later you can connect to the mysql daemon using :
$this->funcs["connect"]($host,$user,$pass) ;
http://www.php.net/manual/functions.variable-functions.php