03-16-2010, 06:21 AM
I wanted to know how to call a function which is present in a class in 1 file from a class in another file. Please help ASAP. I am using PHP 5...
Thank you guys :)
03-16-2010, 03:30 PM
Statically I presume?
Depending on you're version of PHP depends on how you get it in there though. The end result is always an include/require call against you're other class file, but in 5.3.x+ you can chain it against the spl_autoload method to import using the use keyword.
// Or, using spl_autoload if registered directly, include the autoload file and call:
use /path/to/MyOtherClass AS MyOtherClass; // Where MyOtherClass is in namespace /path/to
public function __construct()
Now if you mean that this is an Object method, then you'll need to either pass an instance of an object, create a singleton object for instantiation, or globalize you're object (not recommended).