PHP Класс WPDKArray

## Overview The WPDKArray class is an helper that provides a lot of static method for make easy and fast to works with array.
Автор: =undo= ([email protected])
Наследование: extends WPDKObject
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$__version string Override version

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

Метод Описание
append ( array $array, array &$dest ) : array Append an array or key value pairs array in a destination array. The $dest array is changed.
arrayExtractByKey ( array $sourceArray, array $arrayKeys ) : array Return a new key value pairs array with element that match with key of the second array. In other words, if the key of $array_extract is found in keys of $array_key, then that element is catch, else is ignored.
arrayMatch ( array $array_keys, array $array_match ) : array Return a new key value pairs array with element that match with key of the second array. In other words, if the key of $array_match is found in $array_keys, then that element is catch, else is ignored.
arrayMatchWithKeys ( array $array, array $array_match ) : array This is an alias of WPDKArray::arrayMatch() for key value pairs array
arrayMatchWithValues ( array $array, array $array_match ) : array This is an alias of WPDKArray::arrayMatch() for key value pairs array
arrayToObject ( array $array ) : object Convert an array into a stdClass()
arrayWithKey ( array $array_key, array $array_extract ) : array Return a new key value pairs array with element that match with key of the second array. In other words, if the key of $array_extract is found in keys of $array_key, then that element is catch, else is ignored.
fit ( array $source, array $defaults ) : array Return a merged array from default and source. If source array has some key miss in defaults array, an unset on that key is performed.
httpBuildQuery ( array $formdata, null $numeric_prefix = null, null $arg_separator = null ) : string Simulates the behavior of http_build_query() in the previous versions of php 5
insert ( array &$arr, array $new, integer $index ) : array Insert an array or key value pairs array in a second array to a specify index
insertKeyValuePairs ( array $arr, string $key, mixed $val, integer $index ) : array Insert a key => value into a second array to a specify index
objectToArray ( object $object ) : array Convert a object to an array
prepend ( array $array, array &$dest ) : array Prepend an array or key value pairs array in a destination array. The $dest array is changed.
stripKeys ( array $source, array $keeplist ) : mixed Return a key pairs array start from source without the keys not present in keeplist
wrapArray ( array $array ) : array Warp each element of an array with an array

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

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

Append an array or key value pairs array in a destination array. The $dest array is changed.
public static append ( array $array, array &$dest ) : array
$array array Source array to prepend
$dest array Reference to destination array
Результат array

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

Return a new key value pairs array with element that match with key of the second array. In other words, if the key of $array_extract is found in keys of $array_key, then that element is catch, else is ignored.
Устаревший: since 1.4.8
public static arrayExtractByKey ( array $sourceArray, array $arrayKeys ) : array
$sourceArray array A source key value pairs array that have to match with a specific key
$arrayKeys array A key value pairs array with the keys to match
Результат array

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

Return a new key value pairs array with element that match with key of the second array. In other words, if the key of $array_match is found in $array_keys, then that element is catch, else is ignored.
С версии: 1.4.8
public static arrayMatch ( array $array_keys, array $array_match ) : array
$array_keys array An array with the keys for match
$array_match array A source key value pairs array that have to match with a specific key
Результат array

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

This is an alias of WPDKArray::arrayMatch() for key value pairs array
С версии: 1.4.8
public static arrayMatchWithKeys ( array $array, array $array_match ) : array
$array array A key vaues pairs array where the values are used as key for match
$array_match array A source key value pairs array that have to match with a specific key
Результат array

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

This is an alias of WPDKArray::arrayMatch() for key value pairs array
С версии: 1.4.8
public static arrayMatchWithValues ( array $array, array $array_match ) : array
$array array A key vaues pairs array where the values are used as key for match
$array_match array A source key value pairs array that have to match with a specific key
Результат array

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

Convert an array into a stdClass()
public static arrayToObject ( array $array ) : object
$array array The array we want to convert
Результат object

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

Return a new key value pairs array with element that match with key of the second array. In other words, if the key of $array_extract is found in keys of $array_key, then that element is catch, else is ignored.
Устаревший: since 1.4.8
public static arrayWithKey ( array $array_key, array $array_extract ) : array
$array_key array A key value pairs array with the keys to match
$array_extract array A source key value pairs array that have to match with a specific key
Результат array

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

Return a merged array from default and source. If source array has some key miss in defaults array, an unset on that key is performed.
С версии: 1.3.0
public static fit ( array $source, array $defaults ) : array
$source array A key pairs array
$defaults array A key pairs array with default keys and values
Результат array

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

Simulates the behavior of http_build_query() in the previous versions of php 5
public static httpBuildQuery ( array $formdata, null $numeric_prefix = null, null $arg_separator = null ) : string
$formdata array Array $key => $value
$numeric_prefix null See http_build_query() documentation
$arg_separator null See http_build_query() documentation
Результат string

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

Insert an array or key value pairs array in a second array to a specify index
public static insert ( array &$arr, array $new, integer $index ) : array
$arr array Source array
$new array New array
$index integer Optional. Index zero base
Результат array

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

Insert a key => value into a second array to a specify index
public static insertKeyValuePairs ( array $arr, string $key, mixed $val, integer $index ) : array
$arr array Source array
$key string Key
$val mixed Value
$index integer Optional. Index zero base
Результат array

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

Convert a object to an array
public static objectToArray ( object $object ) : array
$object object The object we want to convert
Результат array

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

Prepend an array or key value pairs array in a destination array. The $dest array is changed.
public static prepend ( array $array, array &$dest ) : array
$array array Source array to prepend
$dest array Reference to destination array
Результат array

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

Return a key pairs array start from source without the keys not present in keeplist
С версии: 1.3.0
public static stripKeys ( array $source, array $keeplist ) : mixed
$source array Source key pairs array
$keeplist array Key pairs array with the list of key to keep
Результат mixed

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

Warp each element of an array with an array
public static wrapArray ( array $array ) : array
$array array An array
Результат array

Описание свойств

$__version публичное свойство

Override version
public string $__version
Результат string