I defined a myArr = (\"Apr\",\"Mar\",\"May\")
. Is there a sorting function to sort the array members by nature month sequence otherwise by alphabet.
Th
No. there is no such a function. But.... you still can solve your problem gracefully. You should associate months names with numbers (1 is for Jan, 2 is for Feb and so on). This is the most common approach in programming.
Define your array as:
$myArr = array(1=>"Jan", 2=>"Feb" ... )
And then you can sort your $myArr by keys (ksort):
ksort($myArr);
var_export($myArr);
That would sort your array in ascendant order by keys.