HumHub Documentation (unofficial)

ReplaceArrayValue
in package

Object that represents the replacement of array value while performing [[ArrayHelper::merge()]].

Usage example:

$array1 = [
    'ids' => [
        1,
    ],
    'validDomains' => [
        'example.com',
        'www.example.com',
    ],
];

$array2 = [
    'ids' => [
        2,
    ],
    'validDomains' => new \yii\helpers\ReplaceArrayValue([
        'yiiframework.com',
        'www.yiiframework.com',
    ]),
];

$result = \yii\helpers\ArrayHelper::merge($array1, $array2);

The result will be

[
    'ids' => [
        1,
        2,
    ],
    'validDomains' => [
        'yiiframework.com',
        'www.yiiframework.com',
    ],
]
Tags
author

Robert Korulczyk robert@korulczyk.pl

since
2.0.10

Table of Contents

Properties

$value  : mixed

Methods

__construct()  : mixed
Constructor.
__set_state()  : ReplaceArrayValue
Restores class state after using `var_export()`.

Properties

Methods

__construct()

Constructor.

public __construct(mixed $value) : mixed
Parameters
$value : mixed

value used as replacement.


        
On this page

Search results