Javatpoint Logo
Javatpoint Logo

PHP prev() function

The PHP prev( ) function is used to fetch the array value in the previous place, pointed by the internal array pointer. This function was introduced in PHP 4.0.

Syntax

Parameter

Parameter Description Is compulsory
array Specifies the array to use. compulsory

Returns

The prev( ) function returns the value of the previous element in the array on success or false if there are no more elements.

Example 1

Output:

php
Java

Example 2

Output:

Java
php
Java

Example 3

Output:

arctic
antarctic
arctic

Example 4

Output:

arctic
indian
arctic
arctic





Help Others, Please Share

facebook twitter pinterest