PHP code example of mawebdk / array-utils

1. Go to this page and download the library: Download mawebdk/array-utils library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

mawebdk / array-utils example snippets


try {
    $arrayValue         = ArrayUtils::getArrayFromKey(array $array, string $key);
    $arrayOrNullValue   = ArrayUtils::getArrayOrNullFromKey(array $array, string $key);
    $integerValue       = ArrayUtils::getIntegerFromKey(array $array, string $key);
    $integerOrNullValue = ArrayUtils::getIntegerOrNullFromKey(array $array, string $key);
    $floatValue         = ArrayUtils::getFloatFromKey(array $array, string $key);
    $stringValue        = ArrayUtils::getStringFromKey(array $array, string $key);
    $stringOrNullValue  = ArrayUtils::getStringOrNullFromKey(array $array, string $key);
    $booleanValue       = ArrayUtils::getBooleanFromKey(array $array, string $key);
} catch (ArrayUtils $e) {
    // Error handling.
}

try {
    $integerValue = ArrayUtils::getStringAsIntegerFromKey(array $array, string $key);
} catch (ArrayUtils $e) {
    // Error handling.
}

try {
    $integerValue = ArrayUtils::getMixedFromKey(array $array, string $key);
} catch (ArrayUtils $e) {
    // Error handling.
}