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