Namespaces

  • Latte
    • Loaders
    • Macros
    • Runtime
  • Nette
    • Application
      • Responses
      • Routers
      • UI
    • Bridges
      • ApplicationDI
      • ApplicationLatte
      • ApplicationTracy
      • CacheDI
      • CacheLatte
      • DatabaseDI
      • DatabaseTracy
      • DITracy
      • FormsDI
      • FormsLatte
      • Framework
      • HttpDI
      • HttpTracy
      • MailDI
      • ReflectionDI
      • SecurityDI
      • SecurityTracy
    • Caching
      • Storages
    • ComponentModel
    • Database
      • Conventions
      • Drivers
      • Table
    • DI
      • Config
        • Adapters
      • Extensions
    • Forms
      • Controls
      • Rendering
    • Http
    • Iterators
    • Loaders
    • Localization
    • Mail
    • Neon
    • PhpGenerator
      • Traits
    • Reflection
    • Security
    • Tokenizer
    • Utils
  • Tracy
    • Bridges
      • Nette
  • none

Classes

  • ArrayHash
  • ArrayList
  • Arrays
  • Callback
  • DateTime
  • FileSystem
  • Finder
  • Html
  • Image
  • Json
  • ObjectHelpers
  • ObjectMixin
  • Paginator
  • Random
  • Reflection
  • SafeStream
  • Strings
  • TokenIterator
  • Tokenizer
  • Validators

Interfaces

  • IHtmlString

Exceptions

  • AssertionException
  • ImageException
  • JsonException
  • RegexpException
  • TokenizerException
  • UnknownImageFileException
  • Overview
  • Namespace
  • Class
  • Tree
  • Deprecated
  • Other releases

Class Arrays

Array tools library.

Nette\Utils\Arrays uses Nette\StaticClass
Namespace: Nette\Utils
Located at Utils/Arrays.php
Methods summary
public static mixed
# get( array $arr, string|integer|array $key, mixed $default = null )

Returns item from array or $default if item is not set.

Returns item from array or $default if item is not set.

Parameters

$arr
$key
or more keys
$default

Returns

mixed
mixed

Throws

Nette\InvalidArgumentException
if item does not exist and default value is not provided
public static mixed &
# getRef( array & $arr, string|integer|array $key )

Returns reference to array item.

Returns reference to array item.

Parameters

$arr
$key
or more keys

Returns

mixed
mixed

Throws

Nette\InvalidArgumentException
if traversed item is not an array
public static array
# mergeTree( array $arr1, array $arr2 )

Recursively appends elements of remaining keys from the second array to the first.

Recursively appends elements of remaining keys from the second array to the first.

Returns

array
array
public static integer|false
# searchKey( array $arr, $key )

Searches the array for a given key and returns the offset if successful.

Searches the array for a given key and returns the offset if successful.

Returns

integer|false
offset if it is found, false otherwise
public static
# insertBefore( array & $arr, $key, array $inserted )

Inserts new array before item specified by key.

Inserts new array before item specified by key.

public static
# insertAfter( array & $arr, $key, array $inserted )

Inserts new array after item specified by key.

Inserts new array after item specified by key.

public static
# renameKey( array & $arr, $oldKey, $newKey )

Renames key in array.

Renames key in array.

public static array
# grep( array $arr, $pattern, $flags = 0 )

Returns array entries that match the pattern.

Returns array entries that match the pattern.

Returns

array
array
public static array
# flatten( array $arr, $preserveKeys = false )

Returns flattened array.

Returns flattened array.

Returns

array
array
public static boolean
# isList( $value )

Finds whether a variable is a zero-based integer indexed array.

Finds whether a variable is a zero-based integer indexed array.

Returns

boolean
bool
public static array|stdClass
# associate( array $arr, $path )

Reformats table to associative tree. Path looks like 'field|field[]field->field=field'.

Reformats table to associative tree. Path looks like 'field|field[]field->field=field'.

Returns

array|stdClass
array|\stdClass
public static array
# normalize( array $arr, $filling = null )

Normalizes to associative array.

Normalizes to associative array.

Returns

array
array
public static mixed
# pick( array & $arr, string|integer $key, mixed $default = null )

Picks element from the array by key and return its value.

Picks element from the array by key and return its value.

Parameters

$arr
$key
key
$default

Returns

mixed
mixed

Throws

Nette\InvalidArgumentException
if item does not exist and default value is not provided
public static boolean
# some( array $arr, callable $callback )

Tests whether some element in the array passes the callback test.

Tests whether some element in the array passes the callback test.

Returns

boolean
bool
public static boolean
# every( array $arr, callable $callback )

Tests whether all elements in the array pass the callback test.

Tests whether all elements in the array pass the callback test.

Returns

boolean
bool
public static array
# map( array $arr, callable $callback )

Applies the callback to the elements of the array.

Applies the callback to the elements of the array.

Returns

array
array
Methods used from Nette\StaticClass
__callStatic(), __construct()
Nette 2.4-20180918 API API documentation generated by ApiGen 2.8.0