Get Files In Directory

518 Views

In this tutorial I will teach you how to get a list of files in any directory using PHP.
Here we enter the path to the folder that we want to list the items inside images/people

// Search the people folder
foreach (new DirectoryIterator('images/people') as $file) {

// If this is a file then get the name
  if ($file->isFile()) {
      echo $file->getFilename() . "\n";
  }
}

That’s it. If you find this tutorial useful, leave a comment.

Weeks Between Two Dates

473 Views

In this tutorial I will teach you how to get the weeks between two dates in PHP 5 and above.

PHP Calculate Percentage

825 Views

In this tutorial I will teach you how to calculate percentage increase and percentage decreased in PHP.

Welcome to Western Studios

We provide professional website and mobile softwares including Joomla, Wordpress and more.