3

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

thanks

1
  • Just curious.. what benefits are you expecting to gain from having the function in an extension vs a plain custom php function? Commented Oct 2, 2009 at 0:38

3 Answers 3

14

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 ;-)

Sign up to request clarification or add additional context in comments.

1 Comment

thanks a lot Pascal MARTIN actually i searched a lot but didnt get any fruitful result thanks again
1

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)

Comments

0

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.