PHP list array keys


 

PHP list array keys

In this part of the tutorial we will learn about the function array_keys in context of list in PHP. And we will also see the example related to the array_keys() function

In this part of the tutorial we will learn about the function array_keys in context of list in PHP. And we will also see the example related to the array_keys() function

  • array_keys() function returns the keys of the the given array.
  • It returns the keys in the form of array.


Example of PHP list Array Keys

<?php
    $ar1
=array("x"=>"x-mas","y"=>"yak","zebra");
    $key
=array_keys($ar1);
    print_r($key);
?>

   Output
   Array ( [0] => x [1] => y [2] => 0 )

Ads