|
|
PHP Array Previous Function
|
Tutorials » Php »
|
Topic |
What is prev() Function?
|
|
Explanation |
|
The "prev()" function can get the internal pointer to the previous array element
Syntax:
prev(array)
In the above syntax "array" is the array in which the pointer is to be rewinded.
Example
<?php
$b=array("Grapes","Apple","Cherry");
echo current($b)."<br/>";
echo next($b)."<br/>";
echo prev($b)."<br/>";
?>
Result:
Grapes.
Apple.
Grapes.
In the above example the array "$b" first the current value, then the next value and the previous
values are displayed.
|
|
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.
|
|
|
|