Re: Using Arrays in PHP hi,
Here we see use of strnatcmp() function.
strnatcmp -- String comparisons using a "natural order" algorithm.
this function sorting the array using comparison algorithm that orders alphanumeric strings. this called as a "natural ordering".
For example:
$arr = array("img12.png", "img10.png", "img2.png", "img1.png");
usort($arr, "strnatcmp");
print_r($arr);
//output
Array
(
[0] => img1.png
[1] => img2.png
[2] => img10.png
[3] => img12.png
)
--kamal. |