views:

258

answers:

2

Hi,

What is the easiest way to convert a PHP script (.php) into OpCode/Bytecode (Operation Code) using C#? I can use DLLs if I have to.

I need this to be done for the project I am working in order to analyze PHP code easier.

Any thoughts or ideas are welcome.

A: 

I do not think you can do a literal conversion since it is interpreted on the fly. You would essentially have to dissect the PHP engine.

Each PHP engine will be different and in another example of using Phalanger, that is simply being converted to CLR -- ie: it's no longer PHP so you would really be analyzing .NET CLR.

Joe Philllips
So, my best bet is to analyze PHP code directly?
rFactor
I would think so. It depends exactly what you are analyzing.
Joe Philllips
I am trying to analyze the execution flow. For instance, I want to know what is being passed into certain functions and when.
rFactor
+1  A: 

Phalanger is what you're looking for.

arul