I am studying sort_flags at this page on PHP Manual.
And I don’t understand what difference each of these flags represents.
There are only 6 flags, can someone please help me to understand the difference between them. Maybe with some examples. I would be very thankful.
Array used for testing:
Note that
3.14 & 2.72are strings.Using
SORT_REGULARflag (compare items normally):Using
SORT_NUMERICflag (compare items numerically, so3.14is sorted as number not a string):Using
SORT_STRINGflag (SORT_LOCALE_STRINGworks similary, but depends on current locale, all values are treated as strings):Using
SORT_NATURALflag (note order ofimg*strings, it is natural):SORT_FLAG_CASEcan be combined withSORT_STRINGorSORT_NATURALto do case-insensitive sort e.g.: