PHP array_keys() Function
Complete PHP Array Reference
Definition and Usage
The array_keys() function returns an array containing the keys.
Syntax
| Parameter |
Description |
| array |
Required. Specifies an array |
| value |
Optional. You can specify a value, then only the keys with this value are returned |
| strict |
Optional. Used with the value parameter. Possible values:
- true - Returns the keys with the specified value, depending on type: the number
5 is not the same as the string "5".
- false - Default value. Not depending on type, the number 5 is the same as the string "5".
|
Example 1
<?php
$a=array("a"=>"Horse","b"=>"Cat","c"=>"Dog");
print_r(array_keys($a));
?>
|
The output of the code above will be:
Array ( [0] => a [1] => b [2] => c )
|
Example 2
Using the value parameter.
<?php
$a=array("a"=>"Horse","b"=>"Cat","c"=>"Dog");
print_r(array_keys($a,"Dog"));
?>
|
The output of the code above will be:
Example 3
Using the strict parameter: false
<?php
$a=array(10,20,30,"10");
print_r(array_keys($a,"10",false));
?>
|
The output of the code above will be:
Array ( [0] => 0 [1] => 3 )
|
Example 4
Using the strict parameter: true
<?php
$a=array(10,20,30,"10");
print_r(array_keys($a,"10",true));
?>
|
The output of the code above will be:
Complete PHP Array Reference
 |
 |
 |
 |
|
The Ektron Intranet
lets you do everything you need to do on your corporate intranet and everything you want to do... all with just one application.
What can you do with the Ektron Intranet? |
 |
Navigate through content, documents, assets, colleagues and workgroups quickly and intuitively with enterprise search |
 |
Communicate with friends and colleagues with forums, message boards and corporate blogging using the new Social Networking Platform |

|
Utilize the extensive out-of-the box features or customize your site through Ektron CMS400.NET's open architecture |
 |
Promote collaboration in your organization through project workspaces where others can efficiently find information and work together |
 |
Author/edit content, manage navigation, menus, audit trails, workflow and approvals with the best in breed Content Management |
|
|
|
|
See why there are 20,000+ Ektron integrations worldwide.
|
|
 |
TAKE THE VIDEO TOUR |
 |
or download a FREE TRIAL today. |
|