WonderPush PHP library
  • Namespace
  • Class
Navigation
  • Namespace
  • Class
Namespaces
  • WonderPush
    • Api
    • Errors
    • Net
    • Obj
    • Params
    • Util
Classes
  • ArrayUtil
  • DefaultLogger
  • JsonSerializable
  • StringUtil
  • TimeUnit
  • TimeUtil
  • TimeValue
  • UrlUtil
Interfaces
  • Logger

Class ArrayUtil

Utility class for array manipulation.

Namespace: WonderPush\Util
Located at Util/ArrayUtil.php

Methods summary

public static flatten( array $nestedArrays ) : array

Flattens nested non-associative arrays, without preserving keys.

Flattens nested non-associative arrays, without preserving keys.

Return array() if a non array argument has been given.

Parameters

$nestedArrays
The nested arrays to flatten.

Returns

array
public static getIfSet( array $array, integer|string $key, mixed $notSet = null ) : mixed

Return a given array key if it isset or a default value.

Return a given array key if it isset or a default value.

Note: Using isset implies that if the key is present according to array_key_exists() but is associated to the value null, the default value will be returned instead (which defaults to null).

Parameters

$array
The array to look into
$key
The desired key
$notSet
The default value to return if the key is missing or its associated value is null.

Returns

mixed
public static is_not_null( mixed $var ) : boolean

Utility function !is_null().

Utility function !is_null().

Parameters

$var

Returns

boolean

See

WonderPush\Util\ArrayUtil::filterNulls()
public static filterNulls( array $array ) : array

Filter null values from an array.

Filter null values from an array.

This differs from array_filter($array) without callback in that a strict comparison is used for null, so 0, false, "", array() and the like will not be filtered out.

Parameters

$array

Returns

array
WonderPush PHP library API documentation generated by ApiGen