Annotation of embedaddon/php/ext/standard/tests/strings/nl2br_variation3.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: Test nl2br() function : usage variations - heredoc strings for 'str' argument
                      3: --FILE--
                      4: <?php
                      5: /* Prototype  : string nl2br(string $str);
                      6:  * Description: Inserts HTML line breaks before all newlines in a string.
                      7:  * Source code: ext/standard/string.c
                      8: */
                      9: 
                     10: /* Test nl2br() function by passing heredoc strings containing various
                     11:  *   combinations of new line chars to 'str' argument
                     12: */
                     13: 
                     14: echo "*** Testing nl2br() : usage variations ***\n";
                     15: //heredoc string containing new line chars(\n, \r and combinations of \r & \n) and new lines
                     16: $heredoc_str1 = <<<EOD
                     17: \n
                     18: \r
                     19: \r\n
                     20: \nnn\n\n\nn
                     21: \rrr\r\r\rr
                     22: \n\r\n\r\r\n\nr\rn
                     23: EOD;
                     24: 
                     25: //heredoc string containing embedded 'new line chars'/'new lines' in the string
                     26: $heredoc_str2 = <<<EOD
                     27: Hello\nWorld\r
                     28: This is \tes\t for \n \new lines
                     29: like \n \r\n \r \n\r and etc
                     30: EOD;
                     31: 
                     32: var_dump(nl2br($heredoc_str1) );
                     33: var_dump(nl2br($heredoc_str2) );
                     34: 
                     35: echo "Done";
                     36: ?>
                     37: --EXPECTF--
                     38: *** Testing nl2br() : usage variations ***
                     39: string(147) "<br />
                     40: <br />
                     41: 
<br />
                     42: 
<br />
                     43: <br />
                     44: <br />
                     45: nn<br />
                     46: <br />
                     47: <br />
                     48: n<br />
                     49: 
rr<br />
<br />
<br />
r<br />
                     50: <br />
                     51: 
<br />
                     52: 
<br />
                     53: <br />
                     54: r<br />
n"
                     55: string(118) "Hello<br />
                     56: World<br />
                     57: This is        es       for <br />
                     58:  <br />
                     59: ew lines<br />
                     60: like <br />
                     61:  <br />
                     62:  <br />
 <br />
                     63: 
 and etc"
                     64: Done

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>