Glob() Development Tutorials, Guides & Insights
Unlock 1+ expert-curated glob() tutorials, real-world code snippets, and modern dev strategies. From fundamentals to advanced topics, boost your glob() skills on DeveloperBreeze.
Adblocker Detected
It looks like you're using an adblocker. Our website relies on ads to keep running. Please consider disabling your adblocker to support us and access the content.
Code
php
File Listing with glob()
$directoryPath = '/home/user/projects/using-glob';
$fileExtension = 'jpg';
// View files with the specified extension
foreach (glob($directoryPath . '/*.' . $fileExtension) as $image) {
echo basename($image) . "\n";
}
// View all files without a specified extension
foreach (glob($directoryPath . '/*') as $file) {
echo basename($file) . "\n";
}Jan 26, 2024
Read More