Axcelcius Posted January 22, 2008 Share Posted January 22, 2008 Files in the system folder: - cache.sys.php - ajax.js - rss.php I only want it to include cache.sys.php $system_dir = opendir(ROOT_PATH."system/"); echo ROOT_PATH."system/"; while($system_file = readdir($system_dir)){ if(eregi("[a-zA-z0-9].sys.php$", $system_file)){ include_once "./system/".$system_file; } } Link to comment https://forums.phpfreaks.com/topic/87287-include-all-files-that-end-in-specific-suffix/ Share on other sites More sharing options...
Daniel0 Posted January 23, 2008 Share Posted January 23, 2008 No need for regex: <?php $files = glob(ROOT_PATH . 'system/*.sys.php'); foreach( $files as $file ) { include_once $file; } ?> Link to comment https://forums.phpfreaks.com/topic/87287-include-all-files-that-end-in-specific-suffix/#findComment-446723 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.