Got a question that the wiki doesn't answer? Ask on the forum (preferred), or join us on IRC.

BeastNode

CommandHelper/Staged/API/array keys

From EngineHub.org Wiki
Jump to: navigation, search



Vital Info

Name array_keys
Returns array
Usages array
Throws CastException
Since 3.3.0
Restricted
No
Optimizations NO_SIDE_EFFECTS

Description

Returns the keys in this array as a normal array. If the array passed in is already a normal array, the keys will be 0 -> (array_size(array) - 1)

Usages

array_keys(array)

Examples (How do these work?)

Example 1

Basic usage

Given the following code:

1   array_keys(array('a''b''c'))


The output would be:

:{0, 1, 2}

Example 2

With associative array

Given the following code:

1   array_keys(array(one: 'a', two: 'b', three: 'c'))


The output would be:

:{one, three, two}





Navigation menu