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