note 97299 added to class.directoryiterator

From: Date: Tue, 13 Apr 2010 07:36:18 +0000
Subject: note 97299 added to class.directoryiterator
Groups: php.notes 
Request: Send a blank email to php-notes+get-168188@lists.php.net to get a copy of this message
Note that seek() and count() are not always available. At least not on ZendServer CE with PHP 5.2.12 on Mac OSX. Simple test: <?php echo "php ".phpversion().": "; $dirit = new DirectoryIterator( '.' ); var_dump( method_exists( $dirit, 'seek' ) ); var_dump( method_exists( $dirit, 'count' ) ); ?> You can implement them using existing methods: seek(): rewind() and then $pos times next() count(): clone iterator (to keep position), rewind() and then ++$count while ( valid() ) ---- Server IP: 217.160.235.204 Probable Submitter: 188.100.157.114 ---- Manual Page -- http://www.php.net/manual/en/class.directoryiterator.php Edit -- https://master.php.net/note/edit/97299 Del: integrated -- https://master.php.net/note/delete/97299/integrated Del: useless -- https://master.php.net/note/delete/97299/useless Del: bad code -- https://master.php.net/note/delete/97299/bad+code Del: spam -- https://master.php.net/note/delete/97299/spam Del: non-english -- https://master.php.net/note/delete/97299/non-english Del: in docs -- https://master.php.net/note/delete/97299/in+docs Del: other reasons-- https://master.php.net/note/delete/97299 Reject -- https://master.php.net/note/reject/97299 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#168188) next »