Why are my \n not working in PHP?
Posted
by Doug
on Stack Overflow
See other posts from Stack Overflow
or by Doug
Published on 2010-04-29T23:48:46Z
Indexed on
2010/04/29
23:57 UTC
Read the original article
Hit count: 214
I'm playing with SAX and noticed it's not line breaking properly. I have no iea why.
function flush_data() {
global $level, $char_data;
$char_data = trim($char_data);
if( strlen( $char_data ) > 0 ) {
print "\n";
$data = split("\n", wordwrap($char_data, 76 - ($level*2)));
foreach($data as $line) {
print str_repeat(' ', ($level +1)) . "[".$line."]"."\n";
}
}
$char_data = '';
}
© Stack Overflow or respective owner