I have a array. for example:
array(\"Apple\", \"Orange\", \"Banana\", \"Melon\");
i want to sort the array that first will be \"orange\
What you looking for is usort, you can specify custom function to sort the array
example:
function cmp($a, $b)
{
if ($a == "Orange") {
return 1;
}
if ($b == "Orange") {
return -1;
}
return strcmp($a, $b);// or any other sort you want
}
$arr = array("Apple", "Orange", "Banana", "Melon");
usort($arr, "cmp");