i have a folder called XXX it contains .jpg .gif .txt .... etc
i want only to read .txt files how to do that ?
Thanks
You can use glob
to get an array of file names that match a given pattern. Here’s the example from the manual page:
foreach (glob("*.txt") as $filename) {
echo "$filename size " . filesize($filename) . "\n";
}
<?php
foreach (glob("*.txt") as $filename) {
echo "$filename size " . filesize($filename) . "\n";
}
?>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With