On Apr 11, 10:43 am, Neda-k <neda.ker...@gmail.comwrote:
On Apr 11, 2:21 am, NC <n...@iname.comwrote:
you either have to write your own functions (possibly by porting
from Fortran or C) or wrap some previously written C code into
a PHP extension.
Sorry if the questions sounds stupid, but how do I wrap or port code
from somewhere else?
To wrap previously written C code into a PHP extension, you need to
be able to program in C. Sara Golemon has written a fairly detailed
four-part introduction into writing PHP extentsions:
http://devzone.zend.com/article/1021 http://devzone.zend.com/article/1022 http://devzone.zend.com/article/1023 http://devzone.zend.com/article/1024
She has also written a book titled "Extending and Embedding PHP":
http://www.amazon.com/exec/obidos/ASIN/067232704X
Essentially, wrapping a C library into a PHP extension makes the
library's functionality available to PHP.
As to porting, you need to understand the language you are porting
from. You keep asking yourself two questions: (1) what does this
piece of code do in the original code?, and (2) how do I write an
equivalent piece of code in my target language?
Cheers,
NC