Display processed PHP Code?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
waradmin
Forum Contributor
Posts: 240
Joined: Fri Nov 04, 2005 2:57 pm

Display processed PHP Code?

Post by waradmin »

I know its possible to display the contents of say a .html file or even a .php file using PHP code. But, heres the kicker, is it possible to display the code after it has been processed by the PHP engine? And I am not asking about the output I am talking about the actual code.

So:
Request for file is made -> file is processed by PHP Engine -> the processed code is displayed but NOT the output, simply what the php encoder reads

I know this is a random question but if its possible let me know how, just wondering if its possible to send a file through the interpriter and then read the file contents once they have passed through.

Sorry for the randomness of this question.

Regards
-Steve
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

if you are running it through the php interpreter, then I'd say no. Although, there are some useful functions you can use, such as highlight_file(), highlight_string(), or change the php extension to phps
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

what do you define as "what php encoder reads"? Maybe some examples of what you're looking for would help.
User avatar
waradmin
Forum Contributor
Posts: 240
Joined: Fri Nov 04, 2005 2:57 pm

Post by waradmin »

The only example I can think of is: a file is encoded as Zend, thus once the file passes through the Zend engine the code is processed into PHP readable code thus the output for the code would be the decoded code.

I know that sounds bad but I cant think of another way to explain it.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

last I checked, once php has done it's first pass, it is converted into opcodes. Is that what you're wanting to see? Or the code just prior to being converted?
User avatar
waradmin
Forum Contributor
Posts: 240
Joined: Fri Nov 04, 2005 2:57 pm

Post by waradmin »

After it has been processed by say the Zend Engine.
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Post by Benjamin »

A sure fire way to do that is to add some code to the php engine which writes the parsed php code to a file after it parses it & before it processes it. You would most likely have to recompile it.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

after it's been processed by the engine would be the output the file generates.
User avatar
waradmin
Forum Contributor
Posts: 240
Joined: Fri Nov 04, 2005 2:57 pm

Post by waradmin »

Im looking at more displaying the code the PHP engine recieves (after its passed through all decoders).
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Are you wanting to see what an encoded script has in it? Because outside of those, the source file would be what PHP's engine recieves.
Post Reply