faqts : Computers : Programming : Languages : PHP

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

8 of 21 people (38%) answered Yes
Recently 3 of 10 people (30%) answered Yes

Entry

How do I write a php script within a php script to a file without escaping everything?

Apr 19th, 2001 03:41
Onno Benschop, Nick N,


Cheat. The problem is that if you include the <? and ?> tags in your 
output code, the PHP interpreter comes along and starts to want to 
interprate the code. So don't put them together.
This example assumes that you have opened a file and that the standard 
output is going to that file. I'm leaving the actual code as an 
exercise to the reader :-)
<?
    phpCode
    echo '<' ;
    echo '?' ;
?>
phpCode to include in the file
<?
    echo '?' ;
    echo '>' ;
?>