PHP 8.5.8 Released!

SplFixedArray::current

(PHP 5 >= 5.3.0, PHP 7)

SplFixedArray::currentReturn current array entry

说明

public function SplFixedArray::current(): mixed

Get the current array element.

参数

此函数没有参数。

返回值

The current element value.

错误/异常

Throws RuntimeException when the internal array pointer points to an invalid index or is out of bounds.

发现了问题?

了解如何改进此页面提交拉取请求报告一个错误
+添加备注

用户贡献的备注 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"
+添加备注

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