1--TEST-- 2SPL: Test ArrayObject::uasort() function : basic functionality 3--FILE-- 4<?php 5/* Sort the entries by values user defined function. 6 * Source code: ext/spl/spl_array.c 7 * Alias to functions: 8 */ 9 10echo "*** Testing ArrayObject::uasort() : basic functionality ***\n"; 11 12// Reverse sorter 13function cmp($value1, $value2) { 14 if($value1 == $value2) { 15 return 0; 16 } 17 else if($value1 < $value2) { 18 return 1; 19 } 20 else 21 return -1; 22} 23$ao = new ArrayObject(array(2,3,1)); 24 25$ao->uasort('cmp'); 26var_dump($ao); 27?> 28--EXPECT-- 29*** Testing ArrayObject::uasort() : basic functionality *** 30object(ArrayObject)#1 (1) { 31 ["storage":"ArrayObject":private]=> 32 array(3) { 33 [1]=> 34 int(3) 35 [0]=> 36 int(2) 37 [2]=> 38 int(1) 39 } 40} 41