PHP current() Function: Usage and Examples

The current() function is used to return the value of the current element in an array. Before calling this function, the internal pointer of the array needs to be pointed to the first element using the reset() function.

Grammar: Syntax

current(array)

Original: 他们的新电影将于下周上映。
Paraphrased: Their new movie will be released next week.

$colors = array("red", "green", "blue");

echo current($colors); // 输出:red
next($colors);
echo current($colors); // 输出:green
bannerAds