Results 1 to 2 of 2
Oct 24, 2013, 09:04 #1
- Join Date
- Apr 2013
- 6 Post(s)
- 0 Thread(s)
Questions about writing PHP extensions in C/C++
Well I've been designing my own String and Array classes for my application framework, it works pretty well so far but there is a problem. With arrays it's not an issue as my class extends PHP's SplFixedArray and performance is actually better than PHP built-in array. With string however, the string object is about 3-5x slower than PHP native string.
I've been researching into how to improve performance further, and this idea of writing PHP extension comes into my eyes. It seems that writing a PHP class in C/C++ as an extension is considerably faster than writing in PHP, it can come in handy with objects that you will likely to mass produce(string for instance). However, I still have a few questions about writing PHP extensions.
1. How can I port a C/C++ class into PHP from application code? As I am writing a software that will be used by clients, they may install/run my script on shared hosts. Is this gonna be a problem as it probably needs to recompile PHP source code?
2. The hacker's guide to write classes has nothing in it, no idea why. Anyone actually has a tutorial for writing PHP extensions for classes? Or is there a book/online-tutorial that describes how to write PHP extensions in details?
Id appreciate if any of you advanced/expert coders answer my questions, many thanks for just reading through it.
Oct 24, 2013, 10:09 #2
Originally Posted by Hall of Famer
- Join Date
- Jul 2006
- Augusta, Georgia, United States
- 12 Post(s)
- 3 Thread(s)
Originally Posted by Hall of FamerThe only code I hate more than my own is everyone else's.