Menu Home

prev

osbo.com | PHP | Functions | prev

Rewind the internal array pointer

Syntax

prev ( array &$array ) : mixed

Parameters

array

The input array.

Return

Returns the array value in the previous place that's pointed to by the internal array pointer, or FALSE if there are no more elements.

Examples

<?

$array = array('foot', 'bike', 'car', 'plane');

echo end($array) . PHP_EOL;
echo prev($array) . PHP_EOL;
echo prev($array) . PHP_EOL;
echo prev($array);

?>
plane
car
bike
foot

Internal

current

end

next

reset

External

PHP