What is the array_keys() function?

Share

PHP array_keys() function returns an array containing all the keys inside the array. array_keys() returns the keys, numerics, and strings from the array.

Syntax

array_keys(array, value, strict)

Parameters:

  • array: an array containing keys to return.

  • search_value: if specified, then only keys containing the specified values are returned.

  • strict: determines if strict comparison (===) should be used during the search.

What is meant by keys and elements?
What is meant by keys and elements?
<?php
$a=array("Ahmedabad"=>"AMD","London"=>"LHE","New york"=>"JFK");
print_r(array_keys($a));
?>

Enter the input below

Copyright ©2024 Educative, Inc. All rights reserved