reset

Set the internal pointer of an array to its first element

Syntax

reset(array|object &$array): mixed

Parameters

array

The input array.

Return

Returns the value of the first array element, or false if the array is empty.

Examples

1

<?

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

$return = reset($array);

echo $return;

?>
one

2

<?

$array = array();

$return = reset($array);

var_export($return);

?>
false

Internal

current

end

next

prev

External

PHP

Home Menu