note 94809 deleted from function.glob by danbrown
| From: | danbrown@php.net | Date: | Thu, 26 Nov 2009 18:18:20 +0000 |
| Subject: | note 94809 deleted from function.glob by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-163313@lists.php.net to get a copy of this message | ||
Note Submitter: jason at barkingsnake dot com
----
re:
>> here is a quick fix when nothing matches, glob will return false
>> <?php $files=glob('*.txt')?glob('*.txt'):array(); ?>
>> now you are able to use array function to $files.
Try this instead:
<?php $files = (array) glob('*.txt'); // forces empty array on fail ?>