Page MenuHomePhabricator
Paste P17427

hook array merge test
ActivePublic

Authored by daniel on Wed, Oct 6, 8:56 AM.
<?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 ) );