PHPのメモ帳です。
613 views
<?php
class TestA implements Iterator {
private $arr = [
"name"=>"konishi",
"age"=>43,
"sex"=>"man"
];
public function rewind(){
echo "****** rewind() ******\n";
reset($this->arr);
}
public function key(){
echo "****** key() ******\n";
return key($this->arr);
}
public function current(){
echo "****** current() ******\n";
return current($this->arr);
}
public function next(){
echo "****** next() ******\n";
next($this->arr);
}
public function valid(){
echo "****** valid() ******\n";
return !is_null(key($this->arr));
}
}
$test = new TestA();
foreach($test as $d) {
print($d."\n");
}
?>
Page 5 of 9.
すぺぺぺ
本サイトの作成者。
プログラムは趣味と勉強を兼ねて、のんびり本サイトを作っています。
フレームワークはdjango。
ChatGPTで自動プログラム作成に取り組み中。
https://www.osumoi-stdio.com/novel/