Building custom PHP extension (.so)

You should also consider using Zephir. Its syntax is very similar to PHP. It is specially designed to create PHP extensions and compiles into an extension.

There are even several converters from regular PHP to Zephir. They do not take into account all the peculiarities, so some minor code changes will be needed before compiling. I use sandrokeil/php-to-zephir.


I recommend to read this article:

Extension Writing Part I: Introduction to PHP and Zend

and here's how to compile:

UNIX: Compiling PHP Extensions

Build PHP extensions with SWIG

(I recommend SWIG like mario said)

Read more on Canadian zip codes at Postal codes in Canada since not all letters are being used.


Rather than try and build an extension in C you should consider compiling your source code using HipHop instead. This will be much simpiler and run your code pretty fast.

Tags:

Php