I hacked Zend PHP a bit. I find it overly clever , some people reach it deliberately obfuscated in plain view . PHP source code is a mind that modifies (or violates) substance, depending on how good you are at decoding very mysterious macros. This is my impression of the core.
Writing extensions, however, is a breeze , when you get the hang of Zend helpers, most people with advanced / intermediate C knowledge can go through the basic extension. There are also many examples. One of the best parts of PHP is how the build system is organized, but in the new materials it’s relatively painless. With a little work and patience, almost any C library is fairly easy to extend to PHP.
If you are not well versed in C (and that limits the abuse of the preprocessor), a look at the PHP core will not give you much insight, and you should not refer well if you study C on your own.
Moving:
Don't let anything I say, or that anyone else has to say, keep you from capturing code and looking for yourself. This is said for debugging:
Valgrind (unless you use a lot of suppressions) doesn't help much. PHP (as far as I know) uses summary optimized reads similar to the newer versions of glibc. That is, it will read 32 bits, even if it swallows only 8 bits and trailing NULL.
I never found that GDB really helps PHP. Magic in macros that are very difficult to track.
You will quickly see the Zend error logging features and their version of statements. Using these, printf () debugging is almost useless unless you are debugging a CLI application.
Garbage collection can make you see strange things when using tools like valgrind massif. Using profiling heaps in PHP is an art that I haven't discovered yet.
Finally, I would like to say that it is always nice to see someone looking under the hood of their tongue. SO may use some questions that help to de-mystify the PHP core, so please feel free to post more when you go :)
Also, remember, Zend is not the only forge that php does . While compatibility with Zend is paramount, if you hope it will be accepted, everyone is still free to do their own thing.
source share