<?php
/**
* 例子:rewind();
*/
$arr = new SplFixedArray(5);
$arr[1] = 2;
$arr[4] = "foo";
$a = $arr->key();
var_dump($a);
echo "<br>";
$arr->next();
$a = $arr->key();
var_dump($a);
echo "<br>";
$arr->next();
$a = $arr->key();
var_dump($a);
echo "<br>";
$arr->rewind();
$a = $arr->key();
var_dump($a);
echo "<br>";
?>
上面的例子将输出
int(0)
int(1)
int(2)
int(0)