Answers for "php get first key of 2d array"

PHP
6

php get first key of array

$colors = array(2=>"blue",3 =>"green",1=>"red");
$firstValue = reset($colors); //blue
$firstKey = key($colors); //2
Posted by: Guest on October-30-2019
0

php get first 10 elements of array

$alphabet = array("a", "b", "c", "d", "e","g","h","i","j","k");
$firstFive = array_slice($alphabet, 0, 5); //get first 5 elements of array
Posted by: Guest on August-05-2021

Code answers related to "php get first key of 2d array"

Browse Popular Code Answers by Language