Exemple #1
0
<?php

include "../src/helpers.php";
$result = Extend();
var_dump($result);
Exemple #2
0
/**
 * (macro) TranslateArray
 * Converts keys from one to another.
 */
function TranslateArray($array, $keyMap, $includeOriginal = true)
{
    $result = [];
    foreach ($array as $key => $value) {
        if (is_array($value)) {
            $result = Extend($result, TranslateArray($value, $keyMap, $includeOriginal));
        } else {
            if (isset($keyMap[$key])) {
                $result[$keyMap[$key]] = $value;
            }
        }
    }
    if ($includeOriginal) {
        $result = Extend($array, $result);
    }
    return $result;
}