1--TEST--
2Test strnatcmp() function : basic functionality
3--FILE--
4<?php
5echo "*** Testing strnatcmp() : basic functionality ***\n";
6
7$a1 = "abc1";
8$b1 = "abc10";
9$c1 = "abc15";
10$d1 = "abc2";
11
12$a2 = "ABC1";
13$b2 = "ABC10";
14$c2 = "ABC15";
15$d2 = "ABC2";
16
17echo "Less than tests\n";
18var_dump(strnatcmp($a1, $b1));
19var_dump(strnatcmp($a1, $c1));
20var_dump(strnatcmp($a1, $d1));
21var_dump(strnatcmp($b1, $c1));
22var_dump(strnatcmp($d1, $c1));
23
24var_dump(strnatcmp($a1, $b2));
25var_dump(strnatcmp($a1, $c2));
26var_dump(strnatcmp($a1, $d2));
27var_dump(strnatcmp($b1, $c2));
28var_dump(strnatcmp($d1, $c2));
29
30
31echo "Equal too tests\n";
32var_dump(strnatcmp($b1, $b1));
33var_dump(strnatcmp($b1, $b2));
34
35echo "Greater than tests\n";
36var_dump(strnatcmp($b1, $a1));
37var_dump(strnatcmp($c1, $a1));
38var_dump(strnatcmp($d1, $a1));
39var_dump(strnatcmp($c1, $b1));
40var_dump(strnatcmp($c1, $d1));
41
42var_dump(strnatcmp($b1, $a2));
43var_dump(strnatcmp($c1, $a2));
44var_dump(strnatcmp($d1, $a2));
45var_dump(strnatcmp($c1, $b2));
46var_dump(strnatcmp($c1, $d2));
47?>
48--EXPECT--
49*** Testing strnatcmp() : basic functionality ***
50Less than tests
51int(-1)
52int(-1)
53int(-1)
54int(-1)
55int(-1)
56int(1)
57int(1)
58int(1)
59int(1)
60int(1)
61Equal too tests
62int(0)
63int(1)
64Greater than tests
65int(1)
66int(1)
67int(1)
68int(1)
69int(1)
70int(1)
71int(1)
72int(1)
73int(1)
74int(1)
75