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