Easy Tutorial
❮ Php Is_Null Function Php Pdo Prepared Statements ❯

PHP array_keys() Function

Complete PHP Array Reference Manual

Example

Returns a new array containing all the keys of the original array:


Definition and Usage

The array_keys() function returns a new array containing all the keys of the original array.


Syntax

Parameter Description
array Required. Specifies the array.
value Optional. You can specify a key value, and only the keys corresponding to that key value will be returned.
strict Optional. Used with the value parameter. Possible values: true - Returns keys with the specified key value. Depends on type, number 5 is different from string "5".<br> false - Default value. Does not depend on type, number 5 is the same as string "5".

Technical Details

Return Value: Returns a new array containing all the keys of the original array.
PHP Version: 4+
--- ---
Changelog: The strict parameter was added in PHP 5.0.
--- ---

More Examples

Example 1

Using the value parameter:

Example 2

Using the strict parameter (false):

Example 3

Using the strict parameter (true):


❮ Php Is_Null Function Php Pdo Prepared Statements ❯