import zend standard tests
[hiphop-php.git] / hphp / test / zend / good / ext-standard-strings / strncasecmp_variation9.php
blob39988e71a0964e78887875d8db91d15e7b630070
1 <?php
2 /* Prototype : int strncasecmp ( string $str1, string $str2, int $len );
3 * Description: Binary safe case-insensitive string comparison of the first n characters
4 * Source code: Zend/zend_builtin_functions.c
5 */
7 /* Test strncasecmp() function with here-doc strings for 'str1', 'str2' */
9 echo "*** Test strncasecmp() function: with here-doc strings ***\n";
11 /* multi line heredoc string */
12 $multi_line_str = <<<EOD
13 Example of string
14 spanning multiple lines
15 using heredoc syntax.
16 EOD;
18 /* identifier name contains underscore */
19 $identifier_str1 = <<<identifier_str1
20 Example of heredoc
21 string, whose identifier
22 having underscore("_")
23 & numeric value.
24 identifier_str1;
26 /* identifier name starts with underscore */
27 $identifier_str2 = <<<_identifier_str2
28 Hello, World
29 hello, world
30 _identifier_str2;
32 /* string containing control character */
33 $control_char_str = <<<EOD
34 Hello, World\n
35 Hello\0World
36 EOD;
38 /* heredoc string with quote chars & slash */
39 $quote_char_string = <<<EOD
40 it's bright,but i cann't see it.
41 "things in double quote"
42 'things in single quote'
43 this\line is /with\slashs
44 EOD;
46 /* heredoc string with blank line */
47 $blank_line = <<<EOD
49 EOD;
51 /* empty heredoc string */
52 $empty_string = <<<EOD
53 EOD;
55 $strings = array(
56 $multi_line_str,
57 $identifier_str1,
58 $identifier_str2,
59 $control_char_str,
60 $quote_char_string,
61 $blank_line,
62 $empty_string
64 /* loop through to compare the strings */
65 $index2 = count($strings);
66 for($index1 = 0; $index1 < count($strings); $index1++) {
67 $index2--;
68 var_dump( strncasecmp( $strings[$index1], $strings[$index1], strlen($strings[$index1]) ) );
69 var_dump( strncasecmp( $strings[$index1], $strings[$index2], strlen($strings[$index1]) ) );
71 echo "*** Done ***\n";