Problem with newline/linefeed in string variable!!!
Posted: Mon Jan 29, 2007 5:33 am
Hi all! First of all, I'm no PHP Guru. I need help removing a newline/linefeed artifact or special (invisible) character from a string, but it does not show up in for example Mozilla's source viewer as an escaped \n or \r. The source viewer displays the following:
which wraps over two lines. The linefeed sits between center;"> and Welcome, but i don't know how to remove it!
It is generated from the script:
As you can see I've attemted to remove the newline/linefeed with ereg_replace but I am not entirely sure how to get it right. I just need to remove any hidden linefeed characters from the $welcome variable.
Ive tried where xxx was \n \r and even 0x0A. But to no avail. This code is confusing my page AND ME and causing unexpected output!
Thanks for the help in advance!
Code: Select all
area = new HyperTextArea('welcome', '<div style="text-align: center;">
Welcome to Abrem Guest House</div>', 420, 200,'');It is generated from the script:
Code: Select all
print "
<script language='JavaScript' type='text/javascript'>
area = new HyperTextArea('welcome', '".ereg_replace('0x0D','',$welcome)."', 420, 200,'');
</script>
";Ive tried
Code: Select all
ereg_replace('xxx','',$welcome)Thanks for the help in advance!