philip Sat Jul 13 21:16:48 2002 EDT Modified files: /phpdoc/en/reference/array/functions natsort.xml Log: <note> usort($arr, 'strnatcmp') to keep index/value associations. Index: phpdoc/en/reference/array/functions/natsort.xml diff -u phpdoc/en/reference/array/functions/natsort.xml:1.4 phpdoc/en/reference/array/functions/natsort.xml:1.5 --- phpdoc/en/reference/array/functions/natsort.xml:1.4 Sun May 12 04:19:28 2002 +++ phpdoc/en/reference/array/functions/natsort.xml Sat Jul 13 21:16:48 2002 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.4 $ --> +<!-- $Revision: 1.5 $ --> <!-- splitted from ./en/functions/array.xml, last change in rev 1.25 --> <refentry id="function.natsort"> <refnamediv> @@ -26,6 +26,7 @@ <title><function>natsort</function> example</title> <programlisting role="php"> <![CDATA[ +<?php $array1 = $array2 = array ("img12.png", "img10.png", "img2.png", "img1.png"); sort($array1); @@ -35,6 +36,7 @@ natsort($array2); echo "\nNatural order sorting\n"; print_r($array2); +?> ]]> </programlisting> </example> @@ -68,6 +70,12 @@ url="&url.strnatcmp;">Natural Order String Comparison</ulink> page. </para> + <note> + <para> + If you're wanting to maintain index/value associations, consider + using <literal>usort($arr, 'strnatcmp')</literal>. + </para> + </note> <para> See also <function>natcasesort</function>, <function>strnatcmp</function>, and
-- PHP Documentation Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php