PHP Класс Bolt\Helpers\Arr

Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
isAssociative ( array $array ) : boolean Returns whether the given item is an associative array.
isIndexed ( array $array ) : boolean Returns whether the given item is an indexed array - zero indexed and sequential.
isIndexedArray ( array $arr ) : boolean Use {@see isIndexed} or {@see isAssociative} instead.
makeValuePairs ( array $array, string $key, string $value ) : array Make a simple array consisting of key=>value pairs, that can be used in select-boxes in forms.
mergeRecursiveDistinct ( array &$array1, array &$array2 ) : array This is the same as {@see array_replace_recursive}.
replaceRecursive ( array $array1, array $array2 ) : array Replaces values from second array into first array recursively.

Описание методов

isAssociative() публичный статический Метод

Note: Empty arrays are not.
public static isAssociative ( array $array ) : boolean
$array array
Результат boolean

isIndexed() публичный статический Метод

Note: Empty arrays are.
public static isIndexed ( array $array ) : boolean
$array array
Результат boolean

isIndexedArray() публичный статический Метод

This is the same as isIndexed but it does not check if array is zero-indexed and has sequential keys.
Устаревший: since 3.3, to be removed in 4.0.
public static isIndexedArray ( array $arr ) : boolean
$arr array
Результат boolean True if indexed, false if associative

makeValuePairs() публичный статический Метод

Make a simple array consisting of key=>value pairs, that can be used in select-boxes in forms.
public static makeValuePairs ( array $array, string $key, string $value ) : array
$array array
$key string
$value string
Результат array

mergeRecursiveDistinct() публичный статический Метод

Use that instead or the smarter {@see \replaceRecursive}.
Устаревший: since 3.3, to be removed in 4.0.
public static mergeRecursiveDistinct ( array &$array1, array &$array2 ) : array
$array1 array
$array2 array
Результат array

replaceRecursive() публичный статический Метод

This differs from {@see \array_replace_recursive} in a couple ways: - Lists (indexed arrays) from second array completely replace list in first array. - Null values from second array do not replace lists or associative arrays in first (they do still replace scalar values).
public static replaceRecursive ( array $array1, array $array2 ) : array
$array1 array
$array2 array
Результат array The combined array