note 106503 added to class.seekableiterator
| From: | svenr at selfhtml dot org | Date: | Tue, 15 Nov 2011 00:21:20 +0000 |
| Subject: | note 106503 added to class.seekableiterator | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-184442@lists.php.net to get a copy of this message | ||
Best method:
<?php
if ($object instanceof SeekableIterator) {
echo "\$object has method seek()";
}
?>
Please, make use of checking if a particular interface has been implemented to assure that the
object you are dealing with definately has the methods you are about to use.
This also works as typehinting:
<?php
class foo {
public function doSomeSeeking(SeekableIterator $seekMe) {
$seekMe->seek(10); // will work, otherwise Typehint triggers complaints
}
}
?>
----
Server IP: 217.160.235.204
Probable Submitter: 89.204.154.39
----
Manual Page -- http://www.php.net/manual/en/class.seekableiterator.php
Edit -- https://master.php.net/note/edit/106503
Del: integrated -- https://master.php.net/note/delete/106503/integrated
Del: useless -- https://master.php.net/note/delete/106503/useless
Del: bad code -- https://master.php.net/note/delete/106503/bad+code
Del: spam -- https://master.php.net/note/delete/106503/spam
Del: non-english -- https://master.php.net/note/delete/106503/non-english
Del: in docs -- https://master.php.net/note/delete/106503/in+docs
Del: other reasons-- https://master.php.net/note/delete/106503
Reject -- https://master.php.net/note/reject/106503
Search -- https://master.php.net/manage/user-notes.php