Answers for "php how to get all the array keys"

PHP
6

php all keys in array

<?php
$array = array(
    'fruit1' => 'apple',
    'fruit2' => 'orange',
    'fruit3' => 'grape',
    'fruit4' => 'apple',
    'fruit5' => 'apple');

$keys = array_keys($array);		// return array
$values = array_values($array);	// return array
?>
Posted by: Guest on April-29-2020
0

get all key from array php

<?php
$array1=array("Orange" => 100, "Apple" => 200, "Banana" => 300, "Cherry" => 400);
print_r(array_keys($array1));
?>
Posted by: Guest on May-10-2021

Browse Popular Code Answers by Language