note 116690 deleted from class.iteratoriterator by salathe

From: Date: Thu, 19 Feb 2015 16:37:54 +0000
Subject: note 116690 deleted from class.iteratoriterator by salathe
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-201754@lists.php.net to get a copy of this message
Note Submitter: Falxman ---- Please note that if you are using IteratorIterator with a SplQueue then the valid() method of the iterator will retun false even if there are elements to be iterated in the queue. Example: <?php $q = new SplQueue(); $q->enqueue('something'); $it = new IteratorIterator($q); print (int) $it->valid(); //outputs 0 // but if you call rewind() first then check for valid() it works: $it->rewind(); print (int) $it->valid(); //outputs 1 ?> I don't know if this behavior is intended, but this is what I get on PHP 5.5.9-1ubuntu4.5

« previous php.notes (#201754) next »