1--TEST-- 2SPL: Test ArrayObject::asort() function : basic functionality with array based store 3--FILE-- 4<?php 5/* Prototype : int ArrayObject::asort() 6 * Description: proto int ArrayIterator::asort() 7 * Sort the entries by values. 8 * Source code: ext/spl/spl_array.c 9 * Alias to functions: 10 */ 11 12echo "*** Testing ArrayObject::asort() : basic functionality ***\n"; 13 14$ao1 = new ArrayObject(array(4,2,3)); 15$ao2 = new ArrayObject(array('a'=>4,'b'=>2,'c'=>3)); 16var_dump($ao1->asort()); 17var_dump($ao1); 18var_dump($ao2->asort('blah')); 19var_dump($ao2); 20var_dump($ao2->asort(SORT_NUMERIC)); 21var_dump($ao2); 22?> 23===DONE=== 24--EXPECTF-- 25*** Testing ArrayObject::asort() : basic functionality *** 26bool(true) 27object(ArrayObject)#%d (1) { 28 ["storage":"ArrayObject":private]=> 29 array(3) { 30 [1]=> 31 int(2) 32 [2]=> 33 int(3) 34 [0]=> 35 int(4) 36 } 37} 38 39Warning: asort() expects parameter 2 to be int, string given in %sarrayObject_asort_basic1.php on line %d 40bool(false) 41object(ArrayObject)#%d (1) { 42 ["storage":"ArrayObject":private]=> 43 array(3) { 44 ["a"]=> 45 int(4) 46 ["b"]=> 47 int(2) 48 ["c"]=> 49 int(3) 50 } 51} 52bool(true) 53object(ArrayObject)#%d (1) { 54 ["storage":"ArrayObject":private]=> 55 array(3) { 56 ["b"]=> 57 int(2) 58 ["c"]=> 59 int(3) 60 ["a"]=> 61 int(4) 62 } 63} 64===DONE=== 65