tags:

views:

31

answers:

3

This:

var_dump(nl2br("aaa\naaa", false));

Outputs:

NULL

I am using PHP Version 5.2.13. Doctype is:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"&gt;

What am I doing wrong?

+2  A: 

Have a look at the changelog. The second parameter was added in PHP 5.3.0

Phil Brown
+2  A: 

The second false parameter was added in PHP 5.3. Older versions of the function probably fail if passed an extra parameter they don't expect. Local experiments confirm this, the code runs fine on PHP 5.3 and fails on 5.2.10.

deceze
+1  A: 

Only in PHP 5.3 there are second arg in nl2br.

Alexander.Plutov