List all the files in current directory
Thread TagsAdobe Illustrator Adobe InDesign Adobe Photoshop Android Development Android Programming Android Studio Automation Testing C / C++ Programming Career Options College Lounge css digital marketing Digital Marketing / SEO Fireworks Graphic Design Graphic designing Graphics Design Graphics Designing HTML? Illustrator Internship Training logo Design logo designing Magento Photoshop PHP Programming QA react-native Scroll Website SEO Single Page Website Stock Managment System Testing Typography UI UI/UX Development UI Design UI Designing UI development User Interface UX Design Web Designing Website Design Wordpress wp
Log in with your username and password
Register for free!
Registration at Smart Mentors is completely free and takes only a few seconds. By registering you’ll gain:
- Full Posting Privileges.
- Access to Private Messaging.
- Optional Email Notification.
- Ability to Fully Participate.
- Author Replies
- December 6, 2019 at 10:10 am #64183
There is a particular function, specifically created for this use-case, and it doesn’t take much to use it either. It is the scandir() function.
You can easily access the string-form-value path of the current directory by using __Dir__ magic constant.
$rootDir = __DIR__; // __DIR__ = C:\xampp\htdocs\CodeWall
$allFiles = array_diff(scandir($rootDir . “/”), [“.”, “..”]); // Use array_diff to remove both period values eg: (“.” , “..”)
Array (  => css  => img  => index.php  => js  => page1.php  => page2.php )
You must be register. Registration is 100% free.to reply to this thread.Please or