1--TEST--
2Test strncasecmp() function: usage variations - heredoc strings
3--FILE--
4<?php
5/* Test strncasecmp() function with here-doc strings for 'str1', 'str2' */
6
7echo "*** Test strncasecmp() function: with here-doc strings ***\n";
8
9/* multi line heredoc string */
10$multi_line_str = <<<EOD
11Example of string
12spanning multiple lines
13using heredoc syntax.
14EOD;
15
16/* identifier name contains underscore */
17$identifier_str1 = <<<identifier_str1
18Example of heredoc
19string, whose identifier
20having underscore("_")
21& numeric value.
22identifier_str1;
23
24/* identifier name starts with underscore */
25$identifier_str2 = <<<_identifier_str2
26Hello, World
27hello, world
28_identifier_str2;
29
30/* string containing control character */
31$control_char_str = <<<EOD
32Hello, World\n
33Hello\0World
34EOD;
35
36/* heredoc string with quote chars & slash */
37$quote_char_string = <<<EOD
38it's bright,but i cann't see it.
39"things in double quote"
40'things in single quote'
41this\line is /with\slashs
42EOD;
43
44/* heredoc string with blank line */
45$blank_line = <<<EOD
46
47EOD;
48
49/* empty heredoc string */
50$empty_string = <<<EOD
51EOD;
52
53$strings = array(
54  $multi_line_str,
55  $identifier_str1,
56  $identifier_str2,
57  $control_char_str,
58  $quote_char_string,
59  $blank_line,
60  $empty_string
61);
62/* loop through to compare the strings */
63$index2 = count($strings);
64for($index1 = 0; $index1 < count($strings); $index1++) {
65  $index2--;
66  var_dump( strncasecmp( $strings[$index1], $strings[$index1], strlen($strings[$index1]) ) );
67  var_dump( strncasecmp( $strings[$index1], $strings[$index2], strlen($strings[$index1]) ) );
68}
69echo "*** Done ***\n";
70?>
71--EXPECT--
72*** Test strncasecmp() function: with here-doc strings ***
73int(0)
74int(1)
75int(0)
76int(1)
77int(0)
78int(-1)
79int(0)
80int(0)
81int(0)
82int(1)
83int(0)
84int(0)
85int(0)
86int(0)
87*** Done ***
88