Page MenuHomePhabricator

hook array merge test

Authored By
daniel
Oct 6 2021, 8:56 AM
Size
680 B
Referenced Files
None
Subscribers
None

hook array merge test

<?php
$wgHooks1 = [
'Foo' => [
'X::onFoo',
'Y::onFoo',
[ 'myFoo', [ 'n' => 1, 'm' => 2, 3 ] ]
],
'Bar' => [
'X::onBar',
'Y::onBar',
[ 'myBar', [ 'n' => 11, 'm' => 12, 13 ] ]
],
];
$wgHooks2 = [
'Foo' => [
'A::onFoo',
'B::onFoo',
[ 'yourFoo', [ 'n' => 1, 'm' => 2, 3 ] ]
],
'Bar' => [
'A::onBar',
'B::onBar',
[ 'yourBar', [ 'n' => 21, 'm' => 22, 23 ] ]
],
];
print "\n\narray_merge:\n";
var_export( array_merge( $wgHooks1, $wgHooks2 ) );
print "\n\narray_merge_recursive:\n";
var_export( array_merge_recursive( $wgHooks1, $wgHooks2 ) );
print "\n\narray_replace_recursive:\n";
var_export( array_replace_recursive( $wgHooks1, $wgHooks2 ) );

File Metadata

Mime Type
text/plain; charset=utf-8
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
9197653
Default Alt Text
hook array merge test (680 B)

Event Timeline