note 92060 added to language.oop5.autoload
| From: | Peminator at osu1 dot php dot net | Date: | Tue, 07 Jul 2009 14:01:06 +0000 |
| Subject: | note 92060 added to language.oop5.autoload | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-158016@lists.php.net to get a copy of this message | ||
My idea for autoloading FUNCTIONS however only in a weird way :
function ex($parms)
{
$argvar = func_get_args();
$func = $argvar[0];
$funcargs = array_slice($argvar,1);
if (function_exists($func))
{
$returnvalue = call_user_func_array($func,$funcargs);
}
else
{
$funcpath = "scripts/".$func.".php";
require_once($funcpath);
if (function_exists($func))
{
$returnvalue = call_user_func_array($func,$funcargs);
}
else
{
die "SORRY $func IS NOT USABLE";
}
}
// return returned value :-)
return $returnvalue;
}
USAGE EXAMPLE:
must be caled using the X function giving the real function as first parameter, like:
$result = ex("add",1,2);
// returns 3 if add function defined in add.php sums the first and second parameter..
----
Server IP: 64.71.164.2
Probable Submitter: 91.127.22.236
----
Manual Page -- http://www.php.net/manual/en/language.oop5.autoload.php
Edit -- https://master.php.net/note/edit/92060
Del: integrated -- https://master.php.net/note/delete/92060/integrated
Del: useless -- https://master.php.net/note/delete/92060/useless
Del: bad code -- https://master.php.net/note/delete/92060/bad+code
Del: spam -- https://master.php.net/note/delete/92060/spam
Del: non-english -- https://master.php.net/note/delete/92060/non-english
Del: in docs -- https://master.php.net/note/delete/92060/in+docs
Del: other reasons-- https://master.php.net/note/delete/92060
Reject -- https://master.php.net/note/reject/92060
Search -- https://master.php.net/manage/user-notes.php