Sort entries using a "natural order" algorithm with ArrayObject::natsort in PHP
Description
The following code shows how to sort entries using a "natural order" algorithm with ArrayObject::natsort.
Example
//example revised from php.net/*from ww w . j a va2 s. co m*/
<?php
$array = array("img12.png", "img10.png", "img2.png", "img1.png");
$arr1 = new ArrayObject($array);
$arr2 = clone $arr1;
$arr1->asort();
echo "Standard sorting\n";
print_r($arr1);
$arr2->natsort();
echo "\nNatural order sorting\n";
print_r($arr2);
?>
The code above generates the following result.