Home > Article > Backend Development > How to use php current function
PHP current() function is used to return the current unit in the array. Its syntax is current(array). The parameter array is required and refers to the array to be used.
#How to use php current function?
php current() function syntax
Function: Return the value of the current element in the array.
Syntax:
current(array)
Parameters:
array Required. Specifies the array to use.
Description:
Returns the value of the current element in the array. Each array has an internal pointer pointing to its "current" element, initially pointing to the first element inserted into the array.
php current() function usage example 1
<?php $people = array("西门", "灭绝", "无忌"); echo current($people); ?>
Output:
西门
php current() function usage example 2
<?php $arr = array("peter", "灭绝", "欧阳克"); echo current($arr); ?>
Output:
peter
This article is an introduction to the PHP current function. I hope it will be helpful to friends in need!
The above is the detailed content of How to use php current function. For more information, please follow other related articles on the PHP Chinese website!