LonghornPHP 2026

SplFixedArray::rewind

(PHP 5 >= 5.3.0, PHP 7)

SplFixedArray::rewindRebobina el iterador hasta el inicio

Descripción

public function SplFixedArray::rewind(): void

Rebobina el iterador hasta el inicio.

Parámetros

Esta función no contiene ningún parámetro.

Valores devueltos

No se retorna ningún valor.

Found A Problem?

Learn How To Improve This PageSubmit a Pull RequestReport a Bug
+add a note

User Contributed Notes 1 note

up
0
kishor10d at gmail dot com
7 years ago
<?php
/**
 * Example : 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>";
?>

The above example will output:
int(0) 
int(1) 
int(2) 
int(0)
+add a note

AltStyle によって変換されたページ (->オリジナル) /