Page 1 of 1

Output code source, then run it.

Posted: Wed Dec 20, 2006 9:41 pm
by Skara
Ok, say I have this in a file:

Code: Select all

<?php
echo 'blah';
?>
I'd like the out put of the file to be...

Code: Select all

<?php
echo 'blah';
?>
---------
blah
In other words, show the code first (or second, whatever), then run it.


The only way I can think to do this is to add a .htaccess redirection to another file that would read the given file as text, etc etc.

There another way to do this easily?

I plan on using this for teaching purposes, if you're curious.

Posted: Wed Dec 20, 2006 9:43 pm
by brendandonhue
You can do highlight_file() then require().