Hudzilla.org - the homepage of Paul Hudson
Contents > Wish List | Report Bug | About Me ]

20     Writing extensions

This is NOT the latest copy of this book; click here for the latest version.

PHP is an incredibly rich language, as I hope you have come to see by reading this far - there are extensions available to perform all sorts of popular operations with external libraries that really help add power to your script without much effort.

So, why would anyone want to write their own extension? We'll be answering that question in this chapter, as well as designing and producing from scratch a new extension for PHP. Note that this entire chapter requires you have a compiler to hand so that you can compile your extension. You need to be able to compile PHP - usually this requires a Unix operating system, but if you have Windows and a Windows compiler, or Cygwin, that will do also. Otherwise, while the information here might be interesting, you will not be able to make use of it unless you can compile PHP.

Topics covered in this chapter:

  • When to write a custom extension

  • How to design, create, and test your extension


Chapter contents

20.1. Why write your own extension?
20.1.1. The C Perspective
20.2. Before we begin
20.3. First steps
20.4. Hello world - in C!
20.5. C Hello World v2
20.6. Factorials in C
20.7. Extensions Conclusion
20.8. Summary
20.9. Further reading
20.10. Next chapter



<< 19.18 Next chapter   20.1 Why write your own extension? >>
Table of Contents
Want to see this stuff in print? PHP in a Nutshell takes the core topics covered here, adds in thousands of edits from the editorial team and myself, and combines them to make an unbeatable reference for PHP programmers at all levels.



My latest book has hundreds more tips on how to use PHP, Apache, and MySQL, plus Perl, Python, shell scripts, performance tuning, and more!



Top-right shadow
 
Bottom-left shadow Bottom shadow

Comments from other readers
A PHP User - 24 Jul 2008

<a href=http://www.lyricshosting.com>song lyrics</a>

A PHP User - 24 Jul 2008

thank you



Add comment
Please note that by posting a comment here you are committing it to the public domain. This is important so that others can make use of your code themselves, and also so that I can incorporate helpful notes directly into the main text. Comments are limited to 2000 characters in length.

If you are reporting an error in the content, please tell me directly.

Your name/email address:
Your comment:
 
Now, in order to verify that you're a real person, please answer this simple question: what is six plus ten?
The answer is:
(please write in
numbers, eg 19)


Top-right shadow
 
Bottom-left shadow Bottom shadow