I'm trying to retrieve PHP bytecode (and saving it to a file for further analysis) but I'm not sure exactly how to do it... I'm torn between two options:
1) Extending the Zend framework. A good article I found about this was this one: https://nikic.github.io/2012/07/27/How-to-add-new-syntactic-features-to-PHP.html. Using this technique, I would directly rewrite zend_execute() to add the functionality I want. That seems little bit complicated for me, but doable.
2) Using an extension. This seems simpler, at least based on that demo: https://devzone.zend.com/303/extension-writing-part-i-introduction-to-php-and-zend/. That being said, I can't find any resources about how to hook other functions (like zend_execute()), so I'm not sure how/if I can do what I want.
Is there resources you would suggest that I could read? Suggestions about which of these techniques is the easiest/best? Any other techniques I could use?