|
|
PHP Array current() Function
|
Tutorials » Php »
|
Topic |
What is current() Function?
|
|
Explanation |
|
The "current()" function returns the current element in an array. Based on the position of the pointer
of an array, it displays the array element.
Syntax:
current(array)
In the above syntax "array" is the array from which the current element is to be displayed.
Example:
<?php
$b=array("1"=>"Grapes","2"=>"Apple","3" =>"Cherry");
echo current($b)."<br />";
?>
Result:
Grapes
In the above example the current() function returns the current element of the array "$b" that is "Grapes".
|
|
A Note |
Learn PHP programming language tutorial with simple and neat example. Hope you enjoy this free tutorial.
Do give us your valuable feedback and suggestions on this online tutorial. This is a Copyright Content.
|
|
|
|