Annotation of embedaddon/php/ext/standard/tests/array/array_multisort_variation7.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Test array_multisort() function : usage variation - test sort order of all types
! 3: --FILE--
! 4: <?php
! 5: /* Prototype : bool array_multisort(array ar1 [, SORT_ASC|SORT_DESC [, SORT_REGULAR|SORT_NUMERIC|SORT_STRING]] [, array ar2 [, SORT_ASC|SORT_DESC [, SORT_REGULAR|SORT_NUMERIC|SORT_STRING]], ...])
! 6: * Description: Sort multiple arrays at once similar to how ORDER BY clause works in SQL
! 7: * Source code: ext/standard/array.c
! 8: * Alias to functions:
! 9: */
! 10:
! 11: echo "*** Testing array_multisort() : usage variation - test sort order of all types***\n";
! 12:
! 13: // define some classes
! 14: class classWithToString {
! 15: public function __toString() {
! 16: return "Class A object";
! 17: }
! 18: }
! 19:
! 20: class classWithoutToString { }
! 21:
! 22: $inputs = array(
! 23: 'int 0' => 0,
! 24: 'float -10.5' => -10.5,
! 25: array(),
! 26: 'uppercase NULL' => NULL,
! 27: 'lowercase true' => true,
! 28: 'empty string DQ' => "",
! 29: 'string DQ' => "string",
! 30: 'instance of classWithToString' => new classWithToString(),
! 31: 'instance of classWithoutToString' => new classWithoutToString(),
! 32: 'undefined var' => @$undefined_var,
! 33: );
! 34:
! 35: var_dump(array_multisort($inputs));
! 36: var_dump($inputs);
! 37:
! 38: ?>
! 39: ===DONE===
! 40: --EXPECTF--
! 41: *** Testing array_multisort() : usage variation - test sort order of all types***
! 42: bool(true)
! 43: array(10) {
! 44: ["empty string DQ"]=>
! 45: string(0) ""
! 46: ["int 0"]=>
! 47: int(0)
! 48: ["uppercase NULL"]=>
! 49: NULL
! 50: ["undefined var"]=>
! 51: NULL
! 52: [0]=>
! 53: array(0) {
! 54: }
! 55: ["instance of classWithToString"]=>
! 56: object(classWithToString)#1 (0) {
! 57: }
! 58: ["instance of classWithoutToString"]=>
! 59: object(classWithoutToString)#2 (0) {
! 60: }
! 61: ["lowercase true"]=>
! 62: bool(true)
! 63: ["float -10.5"]=>
! 64: float(-10.5)
! 65: ["string DQ"]=>
! 66: string(6) "string"
! 67: }
! 68: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>