Social Icons

Friday, May 24, 2013

Include all PHP files from a directory


Suppose you have a directory (or say folder) consisting of some PHP files and you want to include all of them in your code. You need not to write include for each and every file. Then, you can do it in one line as follows:

<?php
foreach (glob("classes/*.php") as $filename)
{
    include $filename;
}
?>

No comments:

Post a Comment

Total Pageviews