HH\Map::toKeysArray

Description

public function toKeysArray(): array<Tk>

Returns an array whose values are the keys of the current Map.

Return Values

Examples

<?hh

namespace Hack\UserDocumentation\API\Examples\Map\ToKeysArray;

$m = Map {
  'red' => '#ff0000',
  'green' => '#00ff00',
  'blue' => '#0000ff',
  'yellow' => '#ffff00',
};

$keys_array = $m->toKeysArray();

var_dump(is_array($keys_array));
var_dump($keys_array);
Output
bool(true)
array(4) {
  [0]=>
  string(3) "red"
  [1]=>
  string(5) "green"
  [2]=>
  string(4) "blue"
  [3]=>
  string(6) "yellow"
}