View Single Post
  #92 (permalink)  
Old 08-25-2007, 05:27 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 strcmp() function.
strcmp -- Binary safe string comparison

Returns < 0 if str1 is less than str2; > 0 if str1 is greater than str2, and 0 if they are equal.

For example:
$arr = array("img12.png", "img10.png", "img2.png", "img1.png");
usort($arr, "strcmp");
print_r($arr);

//output
Array
(
[0] => img1.png
[1] => img10.png
[2] => img12.png
[3] => img2.png
)

--kamal.
Reply With Quote