A community in which webmasters can ask for help with topics such as PHP coding , MySQL , IT jobs, web design, IT security.
Current location:homephp forumphp talk in 2009 yearHow to use php function without load source file? - page 1
User InfoPosts
How to use php function without load source file?#1
I would like to use my function, for example DebugR(), but I don(t want to use a require or include (with include_path) to load the function file that contains the source.

I know I could use an autoload, but this action must be generic in my php configuration. I think I must create a PHP extension, but is there another way?

posted date: 2009-04-09 11:02:00


Re: How to use php function without load source file?#2
I had made out the solution of this problem. click to view my topic...

hope that hepls.

posted date: 2009-04-09 11:02:01


Re: How to use php function without load source file?#3
Why not use an accelerator which caches the code as BC in the memory?You still need to write the "include" directive.If extension is where you head, then fork from any of the available open source Accelerators out there.

posted date: 2009-04-09 11:05:00


Re: How to use php function without load source file?#4
Thank you Jim Puls, i'll remember how edit futurs questions

posted date: 2009-04-09 11:09:00


Re: How to use php function without load source file?#5
The only feasible way to do that is to use autoloads like this:// your_file.phpfunction __autoload($class){ require_once((./classes/( . $class . (.php();}echo _::Bar();var_dump(_::DebugR());echo _::Foo();// ./classes/_.phpclass _{ function Bar() { return (bar(; } function DebugR() { return true; } function Foo() { return (foo(; }}Of course, every function would be stored inside this _ class.Another alternative, if you are working from within an object is to use the __call() magic method and do something like:return $this->DebugR();

posted date: 2009-04-09 18:23:00


Re: How to use php function without load source file?#6
"I know I could use an autoload, but this action must be generic" I don't want to use autoload. Read the voted answer, it's the best response of the problem.

posted date: 2009-04-10 08:04:00


select page: « 1 »
Copyright ©2008-2017 www.momige.com, all rights reserved.