Minwork Array
  • Minwork Array
  • Common methods
    • has
    • get → getNestedElement
    • set → setNestedElement
    • remove
    • clone
    • getKeysArray
  • Object oriented methods
    • General information
  • Traversing array
    • Finding
    • Iterating
  • Manipulating array
    • Mapping
    • Filtering
    • Grouping
    • Sorting
    • Computations
    • Flattening
  • Validating array
    • check
    • isEmpty
    • isNested
    • isArrayOfArrays
    • isAssoc
    • isUnique
    • isNumeric
    • hasKeys
  • Utility methods
    • pack
    • unpack
    • createMulti
    • forceArray
    • getDepth
    • random
    • shuffle
    • nth
    • getFirstKey
    • getLastKey
    • getFirstValue
    • getLastValue
Powered by GitBook
On this page

Was this helpful?

  1. Common methods

getKeysArray

Definition

Arr::getKeysArray(mixed $keys): array

Description

Transform variable into standardised array of keys.

This method filters out any values that cannot be used as array key leaving only not empty strings and integers as seen in the example below.

All $keys arguments in other methods are normalized using this method

Examples

Arr::getKeysArray(0) -> [0]

Arr::getKeysArray(null) -> []

Arr::getKeysArray('key') -> ['key']

Arr::getKeysArray('key1.0.key2.1') -> ['key1', '0', 'key2', '1']

Arr::getKeysArray([null, 'key1', '', 'key2', 3.1415, 0]) -> ['key1', 'key2', 0]
PreviouscloneNextGeneral information

Last updated 5 years ago

Was this helpful?