Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
prev() function in PHP
The prev() function rewinds the internal array pointer. It outputs the previous element in the array.
Syntax
prev(arr)
Parameters
arr − The specified array. Required.
Return
The pos() function returns the value of the previous element in an array.
Example
The following is an example −
<?php
$arr = array("one", "two");
echo pos($arr);
echo next($arr);
echo prev($arr);
?>
Output
one two one
Advertisements