array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'tr', ), 'this' => array ( 0 => 'function.array-first.php', 1 => 'array_first', 2 => 'Gets the first value of an array', ), 'up' => array ( 0 => 'ref.array.php', 1 => 'Dizi İşlevleri', ), 'prev' => array ( 0 => 'function.array-find-key.php', 1 => 'array_find_key', ), 'next' => array ( 0 => 'function.array-flip.php', 1 => 'array_flip', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'en', 'path' => 'reference/array/functions/array-first.xml', ), 'history' => array ( ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); contributors($setup); ?>
(PHP 8 >= 8.5.0)
array_first — Gets the first value of an array
array
Returns the first value of array if the array is not empty;
null otherwise.
Örnek 1 Basic array_first() Usage
<?php
$array = [1 => 'a', 0 => 'b', 3 => 'c', 2 => 'd'];
$firstValue = array_first($array);
var_dump($firstValue);
?>Yukarıdaki örneğin çıktısı:
string(1) "a"