Jesus · Bible · HTML · CSS · JS · PHP · SVG · Applications

prev

Description

The prev of Array for PHP 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

1

<?

$array = array('one', 'two', 'three', 'four');

$return = prev($array);

var_export($return);

?>
false

2

<?

$array = array('one', 'two', 'three', 'four');

end($array);

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

?>
three
two
one

3

<?

$array = array('one', 'two', 'three', 'four');

reset($array);

$return = prev($array);

var_export($return);

?>
false

4

<?

$array = array();

$return = prev($array);

var_export($return);

?>
false
HomeMenu