This function will list files and directories within a specified directory

E.g. if a directory named web contains some files like index.htm, contactus.htm and some folders like images, documents, products
The script will return

  • index.htm
  • contactus.htm
  • images
  • documents
  • products

$sortflag can be any of below
SORT_REGULAR – compare items normally (don’t change types)
SORT_NUMERIC – compare items numerically
SORT_STRING – compare items as strings
SORT_LOCALE_STRING – compare items as strings, based on the current locale.

Leave a Reply

Your email address will not be published. Required fields are marked *