webkul
webkul

Reputation: 2864

how to write php function

i want to know how i can write php function in c (like strtoupper). if is there any tutorial please put it here

thanks

Upvotes: 3

Views: 994

Answers (3)

voidstate
voidstate

Reputation: 7990

If you just want to call a C function from PHP, you could use Gearman as an intermediary.

http://gearman.org/

http://pecl.php.net/package/gearman (PECL package)

Upvotes: 1

VolkerK
VolkerK

Reputation: 96159

You might also be interested in SWIG, the Simplified Wrapper and Interface Generator:

SWIG is a software development tool that connects programs written in C and C++ with a variety of high-level programming languages. SWIG is used with different types of languages including common scripting languages such as Perl, PHP, Python, Tcl and Ruby.

Upvotes: 0

Pascal MARTIN
Pascal MARTIN

Reputation: 401002

To write a function in C, that can be used from PHP, you'll have to write an extension.

There are not that many informations about that available, unfortunatly...

Still, searching through my bookmarks, here are the links I found :

And, if you are really interested by the subject, and ready to spend some money on it, you could buy the book Extending and Embedding PHP (some pages are available as preview on Google Books too) ; I've seen a couple of times that it was the book to read when interested on this subject (In fact, I've bought it some time ago, and it's an interesting read)

BTW, the author of that book is also the author of the first four articles I linked to ;-)

Upvotes: 14

Related Questions