Faqts : Computers : Programming : Shopping For You : PHP

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

16 of 43 people (37%) answered Yes
Recently 5 of 10 people (50%) answered Yes


How to call from within a PHP extension other extension's functions ?

Sep 1st, 2009 20:29
Scott Mandarich, healthy man, dman, Jonathan Sharp, Jean Gagliardi, http://www.ttnr.org

If you are referring to PHPs source code (written in C) then you would 
need to include the propper header file for that function.
Otherwise if you are referring to PHP code calling a function in an 
extensions API (most likely written in C) there has to be a 
PHP "wrapper" function which points to it. So the short answer, if 
listed on php.net as a PHP function, you can call it. Otherwise you'd 
have to write the wrapper and recompile it yourself.
One more thought, if you are referring to an object in PHP (a class) 
and calling another classes function, there are a few ways you can do 
it, the easiest would be using ::
class A
function fred(){ echo 'Fred is cool'; }
class B
function printSomething(){ A::fred(); }
$B = new B();
Would print "Fred is cool"
This isn't necessairly the best way of using objects/classes. But it