PHP » PYTHON |
login |
register |
about
|
PYTHON array_keys
is this article helpful?
|
Python replacement for PHP's array_keys
[
edit
| history
]
# without search value: myDict.keys() # with search value: [k for k,v in myDict.items() if v == search_value] array_keys(PHP 4, PHP 5) array_keys — Return all the keys of an array Descriptionarray_keys() returns the keys, numeric and string, from the input array. If the optional search_value is specified, then only the keys for that value are returned. Otherwise, all the keys from the input are returned. As of PHP 5, you can use strict parameter for comparison including type (===). Parameters
Return ValuesReturns an array of all the keys in input . Examples
Example #1 array_keys() example
<?php The above example will output: Array ( [0] => 0 [1] => color ) Array ( [0] => 0 [1] => 3 [2] => 4 ) Array ( [0] => color [1] => size )
See Also
|
more
Recently updated
more
Most requested
more
Last requests
|