View Single Post
  #91 (permalink)  
Old 08-25-2007, 05:22 AM
Kamalakannan Kamalakannan is offline
D-Web Analyst
 
Join Date: May 2007
Posts: 299
Kamalakannan is on a distinguished road
Default 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.
Reply With Quote