PHP Class WPDKArray

## Overview The WPDKArray class is an helper that provides a lot of static method for make easy and fast to works with array.
Author: =undo= ([email protected])
Inheritance: extends WPDKObject
Datei anzeigen Open project: wpxtreme/wpdk Class Usage Examples

Public Properties

Property Type Description
$__version string Override version

Public Methods

Method Description
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

Method Details

append() public static method

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
return array

arrayExtractByKey() public static method

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.
Deprecation: 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
return array

arrayMatch() public static method

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.
Since: 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
return array

arrayMatchWithKeys() public static method

This is an alias of WPDKArray::arrayMatch() for key value pairs array
Since: 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
return array

arrayMatchWithValues() public static method

This is an alias of WPDKArray::arrayMatch() for key value pairs array
Since: 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
return array

arrayToObject() public static method

Convert an array into a stdClass()
public static arrayToObject ( array $array ) : object
$array array The array we want to convert
return object

arrayWithKey() public static method

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.
Deprecation: 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
return array

fit() public static method

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.
Since: 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
return array

httpBuildQuery() public static method

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
return string

insert() public static method

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
return array

insertKeyValuePairs() public static method

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
return array

objectToArray() public static method

Convert a object to an array
public static objectToArray ( object $object ) : array
$object object The object we want to convert
return array

prepend() public static method

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
return array

stripKeys() public static method

Return a key pairs array start from source without the keys not present in keeplist
Since: 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
return mixed

wrapArray() public static method

Warp each element of an array with an array
public static wrapArray ( array $array ) : array
$array array An array
return array

Property Details

$__version public_oe property

Override version
public string $__version
return string