I will get to the point and explain what I am trying to accomplish then show you what I currently am using to achieve this.
What I want is to check if directory has any files it at all. Now I usually use readdir and use a while loop to go thru it and what not but I ran up scandir() and thought it would be a bit quicker to use.
I am trying to use a logical operator for when scandir() fails. So for example:
if(false!==scandir($main_directory)){
//do something;
}
at first it seemed to work however when i implemented something else to be done solely when scandir() fails, it seems like it just ignores it and put it regardless.
any thoughts?