[thelist] HOWTO read PHP source code into a textarea

Keith Gaughan keith at digital-crew.com
Fri Feb 25 10:08:16 CST 2005

Michael Pemberton wrote:

> The code you would need is something like this:
> <textarea>
> <?php
> echo implode('', file('nav.php'));
> ?>
> </textarea>
> This is just a quick example, you can throw in some error checking and 
> such stuff yourself.

Slight correction:

<?php echo htmlentities(implode('', file('nav.php'))); ?>

Without the htmlentities() call, strange and nasty things could happen
because the < and > characters haven't been escaped.


More information about the thelist mailing list