Annotation of embedaddon/php/ext/spl/tests/arrayObject_natsort_basic1.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: SPL: Test ArrayObject::natsort() function : basic functionality
3: --FILE--
4: <?php
5: /* Prototype : int ArrayObject::natsort()
6: * Description: proto int ArrayIterator::natsort()
7: Sort the entries by values using "natural order" algorithm.
8: * Source code: ext/spl/spl_array.c
9: * Alias to functions:
10: */
11:
12: echo "*** Testing ArrayObject::natsort() : basic functionality ***\n";
13:
14: $ao1 = new ArrayObject(array('boo10','boo1','boo2','boo22','BOO5'));
15: $ao2 = new ArrayObject(array('a'=>'boo10','b'=>'boo1','c'=>'boo2','d'=>'boo22','e'=>'BOO5'));
16: var_dump($ao1->natsort());
17: var_dump($ao1);
18: var_dump($ao2->natsort('blah'));
19: var_dump($ao2);
20: ?>
21: ===DONE===
22: --EXPECTF--
23: *** Testing ArrayObject::natsort() : basic functionality ***
24: bool(true)
25: object(ArrayObject)#1 (1) {
26: ["storage":"ArrayObject":private]=>
27: array(5) {
28: [4]=>
29: string(4) "BOO5"
30: [1]=>
31: string(4) "boo1"
32: [2]=>
33: string(4) "boo2"
34: [0]=>
35: string(5) "boo10"
36: [3]=>
37: string(5) "boo22"
38: }
39: }
40: bool(true)
41: object(ArrayObject)#2 (1) {
42: ["storage":"ArrayObject":private]=>
43: array(5) {
44: ["e"]=>
45: string(4) "BOO5"
46: ["b"]=>
47: string(4) "boo1"
48: ["c"]=>
49: string(4) "boo2"
50: ["a"]=>
51: string(5) "boo10"
52: ["d"]=>
53: string(5) "boo22"
54: }
55: }
56: ===DONE===
57:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>