Why are my \n not working in PHP?

Posted by Strawberry on Stack Overflow See other posts from Stack Overflow or by Strawberry
Published on 2010-04-29T23:48:46Z Indexed on 2012/05/30 22:40 UTC
Read the original article Hit count: 172

Filed under:
|

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

Related posts about php

Related posts about sax