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
Hoth
Forum Newbie
Posts: 2 Joined: Tue Aug 25, 2009 5:53 am
Post
by Hoth » Tue Aug 25, 2009 5:56 am
Here's a tiny test script that illustrates the problem:
Code: Select all
<?php
echo eval("?>line 1
<?php if (1) { ?>line 2<?php } ?>
line 3
<?php ");
?>
The result is:
How do I get the
result that I expect to get? I can't see why it's eating the line break after the condition.
Hoth
Forum Newbie
Posts: 2 Joined: Tue Aug 25, 2009 5:53 am
Post
by Hoth » Tue Aug 25, 2009 4:59 pm
Thanks. I guess the only way to deal with it is to double them, $doc = str_replace("<?php } ?>\n", "<?php } ?>\n\n", $doc); ? Seems an ugly hack.