1 | <?php |
||
10 | class PDOStatementIterator implements Iterator |
||
11 | { |
||
12 | protected $stmtFactory; |
||
13 | protected $fetchStyle; |
||
14 | protected $currentValue; |
||
15 | protected $currentKey; |
||
16 | |||
17 | public function __construct($stmt, $fetchStyle = PDO::FETCH_BOTH) |
||
27 | |||
28 | public function rewind() |
||
34 | |||
35 | public function valid() |
||
39 | |||
40 | public function current() |
||
44 | |||
45 | public function key() |
||
49 | |||
50 | public function next() |
||
55 | } |
||
56 | |||
57 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: