end
PHP Manual
PHP Manual»Array Funzioni»end

end

(PHP 4, PHP 5, PHP 7, PHP 8)

end Sposta il puntatore interno dell'array all'ultimo elemento

Descrizione

function end(array $array): mixed

end() fa avanzare il puntatore di array all'ultimo elemento, e restituisce il suo valore.

Example #1 Un semplice esempio di end()

<?php

$frutti = array('mela', 'banana', 'mirtillo');
echo end($frutti); // mirtillo
      
?>

Vedere anche current(), each(), prev(), next() e reset().

To Top