note 87425 modified in directoryiterator.construct by thiago

From: Date: Tue, 14 Jul 2009 18:44:56 +0000
Subject: note 87425 modified in directoryiterator.construct by thiago
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-158293@lists.php.net to get a copy of this message
Don't store DirectoryIterator objects for later; you will get an error saying "too many open files" when you store more than the operating system limit (usually 256 or 1024). For example, this will yield an error if the directory has too many files: <?php $files = array(); foreach (new DirectoryIterator('myDir') as $file) { $files[] = $file; } ?> Presumably, this approach is memory intensive as well. --was-- Don't store DirectoryIterator objects for later; you will get an error saying "too many open files" when you store more than the operating system limit (usually 256 or 1024). For example, this will yield an error if the directory has too many files: <? $files = array(); foreach (new DirectoryIterator('myDir') as $file) { $files[] = $file; } ?> Presumably, this approach is memory intensive as well. http://php.net/manual/en/directoryiterator.construct.php

« previous php.notes (#158293) next »