summaryrefslogtreecommitdiff
path: root/ext/standard/tests/strings/strncmp_variation2.phpt
blob: d871a96005b2324073aa9a3de3fd6234468f1e57 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
--TEST--
Test strncmp() function: usage variations - double quoted strings
--FILE--
<?php
/* Test strncmp() function with double quoted strings for 'str1', 'str2' */

echo "*** Test strncmp() function: with double quoted strings ***\n";
$strings = array(
  "Hello, World",
  "hello, world",
  "HELLO, WORLD",
  "Hello, World\n",
  "Hello".chr(0)."World"
);
/* loop through to compare each string with the other string */
$count = 1;
for($index1 = 0; $index1 < count($strings); $index1++) {
  echo "-- Iteration $count --\n";
  for($index2 = 0; $index2 < count($strings); $index2++) {
    var_dump( strncmp( $strings[$index1], $strings[$index2], (strlen($strings[$index1]) + 1) ) );
  }
  $count ++;
}
echo "*** Done ***\n";
?>
--EXPECTREGEX--
\*\*\* Test strncmp\(\) function: with double quoted strings \*\*\*
-- Iteration 1 --
int\(0\)
int\(-[1-9][0-9]*\)
int\([1-9][0-9]*\)
int\(-[1-9][0-9]*\)
int\([1-9][0-9]*\)
-- Iteration 2 --
int\([1-9][0-9]*\)
int\(0\)
int\([1-9][0-9]*\)
int\([1-9][0-9]*\)
int\([1-9][0-9]*\)
-- Iteration 3 --
int\(-[1-9][0-9]*\)
int\(-[1-9][0-9]*\)
int\(0\)
int\(-[1-9][0-9]*\)
int\(-[1-9][0-9]*\)
-- Iteration 4 --
int\([1-9][0-9]*\)
int\(-[1-9][0-9]*\)
int\([1-9][0-9]*\)
int\(0\)
int\([1-9][0-9]*\)
-- Iteration 5 --
int\(-[1-9][0-9]*\)
int\(-[1-9][0-9]*\)
int\([1-9][0-9]*\)
int\(-[1-9][0-9]*\)
int\(0\)
\*\*\* Done \*\*\*