array_keys() function in php || php array

array_keys() function in php

by Pooja Chikara

0 2630

array_keys() function of PHP is used to return all keys of an array means it returns an array which contains all keys of existing array. It is an inbuilt function of PHP.

Syntax:

array_key s($arr);

Here,

$arr is a PHP array.


Example:

<?php
$arr1= array("fruit1"=>"Apple","fruit2"=>"Banana","fruit3"=>"Orange","fruit4"=>"Pear");
$result=array_keys($arr1);
echo "<pre>";
print_r($result);
?>

Output:




Best WordPress Hosting


Share:

SSL for business, from $12.88


Leave a Reply


Comments
    Waiting for your comments

Coding Tag WhatsApp Chat
Coding Tag WhatsApp Chat