File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / standard / tests / strings / bug47481.phpt
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue Feb 21 23:48:04 2012 UTC (12 years, 5 months ago) by misho
Branches: php, MAIN
CVS tags: v5_4_3elwix, v5_4_29p0, v5_4_29, v5_4_20p0, v5_4_20, v5_4_17p0, v5_4_17, v5_3_10, HEAD
php

--TEST--
Bug #47481 (natcasesort() does not sort extended ASCII characters correctly)
--FILE--
<?php
/* Prototype  : bool natcasesort(array &$array_arg)
 * Description: Sort an array using case-insensitive natural sort
 * Source code: ext/standard/array.c
 */

/*
 * Test natcasesort() with extended ASCII characters
 */

$array = array ('Süden', 'spielen','Sonne','Wind','Regen','Meer');
echo "\n-- Before sorting: --\n";
var_dump($array);

echo "\n-- After Sorting: --\n";
var_dump(natcasesort($array));
var_dump($array);

echo "Done";
?>
--EXPECTF--
-- Before sorting: --
array(6) {
  [0]=>
  %string|unicode%(6) "Süden"
  [1]=>
  %string|unicode%(7) "spielen"
  [2]=>
  %string|unicode%(5) "Sonne"
  [3]=>
  %string|unicode%(4) "Wind"
  [4]=>
  %string|unicode%(5) "Regen"
  [5]=>
  %string|unicode%(4) "Meer"
}

-- After Sorting: --
bool(true)
array(6) {
  [5]=>
  %string|unicode%(4) "Meer"
  [4]=>
  %string|unicode%(5) "Regen"
  [2]=>
  %string|unicode%(5) "Sonne"
  [1]=>
  %string|unicode%(7) "spielen"
  [0]=>
  %string|unicode%(6) "Süden"
  [3]=>
  %string|unicode%(4) "Wind"
}
Done

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>