humm, perhaps I didn't make my self very clear, I'll post the actuall code.. this little script converts htmlchars in a file and makes them perfectly echoed.. what I am tryind to do is instead of it converting a file I want it to convert a string containing text..
$etext = file($ntext);
for ($index = 0; $index < count($etext); $index++)
{
$line = $etext[$index];
//insert forward slash before quotes
$line_coded = ereg_replace("\x22", "\x5c\x22", $line);
//strip carriage returns
$line_coded = ereg_replace("\x0d", "", $line_coded);
//strip line feeds
$line_coded = ereg_replace("\x0a", "", $line_coded);
//change < and > to character entity name for output to HTML page
$line_coded = ereg_replace("<", "<", $line_coded);
$line_coded = ereg_replace(">", ">", $line_coded);
//PHP line of code
$etext = "echo \"$line_coded\n\";\n";
}
Do you see my problem..how can I fix this code?