FluidTYPO3\Flux\Utility\RecursiveArrayUtility::mergeRecursiveOverrule PHP Метод

mergeRecursiveOverrule() публичный статический Метод

public static mergeRecursiveOverrule ( array $firstArray, array $secondArray, boolean $notAddKeys = FALSE, boolean $includeEmptyValues = TRUE, boolean $enableUnsetFeature = TRUE ) : array
$firstArray array First array
$secondArray array Second array, overruling the first array
$notAddKeys boolean If set, keys that are NOT found in $firstArray will not be set. Thus only existing value can/will be overruled from second array.
$includeEmptyValues boolean If set, values from $secondArray will overrule if they are empty or zero. Default: TRUE
$enableUnsetFeature boolean If set, special values "__UNSET" can be used in the second array in order to unset array keys in the resulting array.
Результат array Resulting array where $secondArray values has overruled $firstArray values
    public static function mergeRecursiveOverrule(array $firstArray, array $secondArray, $notAddKeys = FALSE, $includeEmptyValues = TRUE, $enableUnsetFeature = TRUE)
    {
        ArrayUtility::mergeRecursiveWithOverrule($firstArray, $secondArray, !$notAddKeys, $includeEmptyValues, $enableUnsetFeature);
        return $firstArray;
    }

Usage Example

Пример #1
0
 /**
  * @test
  */
 public function canOperateMergeRecursiveOverruleFunction()
 {
     $array1 = array('foo' => array('bar' => TRUE));
     $array2 = array('foo' => array('foo' => TRUE, 'bar' => FALSE));
     $expected = array('foo' => array('bar' => FALSE, 'foo' => TRUE));
     $product = RecursiveArrayUtility::mergeRecursiveOverrule($array1, $array2);
     $this->assertSame($expected, $product);
 }
All Usage Examples Of FluidTYPO3\Flux\Utility\RecursiveArrayUtility::mergeRecursiveOverrule