1--TEST-- 2Test natcasesort() function : usage variations - referenced variables 3--FILE-- 4<?php 5/* Prototype : bool natcasesort(array &$array_arg) 6 * Description: Sort an array using case-insensitive natural sort 7 * Source code: ext/standard/array.c 8 */ 9 10/* 11 * Pass an array of referenced varaibles to test how natcasesort() re-orders it 12 */ 13 14echo "*** Testing natcasesort() : usage variation ***\n"; 15 16$value1 = 100; 17$value2 = 33; 18$value3 = 555; 19 20echo "\n-- Initial test --\n"; 21$array = array( &$value1 , &$value2, &$value3); 22var_dump( natcasesort($array) ); 23var_dump($array); 24 25echo "\n-- Change \$value1 --\n"; 26$value1 = -29; 27var_dump( natcasesort($array) ); 28var_dump($array); 29 30echo "Done"; 31?> 32--EXPECTF-- 33*** Testing natcasesort() : usage variation *** 34 35-- Initial test -- 36bool(true) 37array(3) { 38 [1]=> 39 &int(33) 40 [0]=> 41 &int(100) 42 [2]=> 43 &int(555) 44} 45 46-- Change $value1 -- 47bool(true) 48array(3) { 49 [0]=> 50 &int(-29) 51 [1]=> 52 &int(33) 53 [2]=> 54 &int(555) 55} 56Done