This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
uphp:functions:array_keys [2017/02/20 15:34] jeff |
uphp:functions:array_keys [2021/09/13 05:57] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
======array_keys====== | ======array_keys====== | ||
- | < | ||
- | Return keys for an array that has key/value pairs | + | < |
+ | |||
+ | Return keys for an < | ||
====Description==== | ====Description==== | ||
- | <well size=" | + | |
- | <span style=" | + | <well size=" |
- | < | + | <span style=" |
- | <span style=" | + | <span style=" |
- | <span style=" | + | <span style=" |
- | <span style=" | + | <span style=" |
+ | <span style=" | ||
</ | </ | ||
- | Return an array object | ||
- | ====Parameters==== | + | Return an <html><b>< |
- | An < | + | |
- | ====Return | + | ====Parameter==== |
- | An array of keys | + | |
+ | < | ||
+ | |||
+ | ====Return | ||
+ | |||
+ | An < | ||
====Example==== | ====Example==== | ||
- | <code php><? | ||
- | $arr=array(); | ||
- | $arr[' | ||
- | $arr[' | ||
- | $arr[' | ||
- | $keys=array_keys($arr); | ||
- | print_r($keys); | ||
- | /* output | + | <code php> |
- | p0 = ARRAY | + | < |
- | STRING | + | $arr=array(); |
- | STRING | + | $arr[' |
- | STRING | + | $arr[' |
- | */ | + | $arr[' |
- | ?></ | + | $keys=array_keys($arr); |
+ | print_r($keys); | ||
+ | ?></pre> | ||
+ | </ | ||
+ | |||
+ | The above example | ||
+ | < | ||
+ | [$keys] | ||
+ | (string) [0] => name | ||
+ | (string) [1] => age | ||
+ | (string) [2] => status | ||
+ | ) | ||
+ | </ | ||
====See Also==== | ====See Also==== | ||
- | [[array()]] - Create an array with values | ||
- | [[array_key()]] - Return the key for an array index | + | [[array()]] - Create an < |
+ | |||
+ | [[array_key()]] - Return the key for an < | ||
+ | |||
+ | [[sizeof()]] - Return the number of elements in an < | ||
- | [[sizeof()]] - Return | + | [[print_r()]] - Dump the contents |
- | [[print_r()]] - Dump the contents of an array to the current output | + | [[uphp: |