PHP 8.6.0 Beta 1 is available for testing

SplFixedArray::current

(PHP 5 >= 5.3.0, PHP 7)

SplFixedArray::currentDevuelve la entrada del array actual

Descripción

public function SplFixedArray::current(): mixed

Obtiene la entrada del elemento array actual.

Parámetros

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

Valores devueltos

El valor del elemento actual.

Errores/Excepciones

Lanza una excepción de tipo RuntimeException cuando el puntero interno del array apunta a un índice no válido o está fuera de los límites.

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
/**
 * current() : It returns current element in the SplFixedArray.
 */
$arr = new SplFixedArray(5);
$arr[1] = 2;
$arr[2] = "foo";
var_dump($arr->current());
echo "<br>";
$arr->next();
var_dump($arr->current());
echo "<br>";
$arr->next();
var_dump($arr->current());
echo "<br>";
?>

The output of this will be:
NULL 
int(2) 
string(3) "foo"
+add a note

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