PHP Class luya\helpers\ArrayHelper

Author: nadar
Inheritance: extends yii\helpers\BaseArrayHelper
Afficher le fichier Open project: zephir/luya Class Usage Examples

Méthodes publiques

Méthode Description
arrayUnshiftAssoc ( array &$arr, string $key, mixed $val ) : array Prepend an assoc array item as first entry for a given array.
search ( array $array, string $searchText, boolean $sensitive = false ) : array Search trough all keys inside of an array, any occurence will return the rest of the array.
toObject ( array $array ) : object Create an object from an array.
typeCast ( array $array ) : array TypeCast values from a mixed array source. numeric values will be casted as integer.

Method Details

arrayUnshiftAssoc() public static méthode

Prepend an assoc array item as first entry for a given array.
public static arrayUnshiftAssoc ( array &$arr, string $key, mixed $val ) : array
$arr array The array where the value should be prepend
$key string The new array key
$val mixed The value for the new key
Résultat array

toObject() public static méthode

Create an object from an array.
public static toObject ( array $array ) : object
$array array
Résultat object

typeCast() public static méthode

This method is often used to convert corect json respons arrays
public static typeCast ( array $array ) : array
$array array The array which should be type casted
Résultat array An array with type casted values