<?php
0 => 100,
1 => 200,
0 => 7,
1 => 8,
2 => 9
)
);
function walkAroundTheTree
(array &$branch) {
foreach ($branch as &$node) {
// Если у нас вложенный массив
walkAroundTheTree($node);
} else {
// Если число
$node = $node * 2;
}
}
}
walkAroundTheTree($tree);
PD9waHAKCiR0cmVlID0gYXJyYXkoCiAgICAwICAgPT4gIDEwMCwKICAgIDEgICA9PiAgMjAwLAogICAgMiAgID0+ICBhcnJheSgKICAgICAgICAwICAgPT4gIDcsCiAgICAgICAgMSAgID0+ICA4LAogICAgICAgIDIgICA9PiAgOSAgICAgICAgCiAgICApCik7CgpmdW5jdGlvbiB3YWxrQXJvdW5kVGhlVHJlZShhcnJheSAmJGJyYW5jaCkKewogICAgZm9yZWFjaCAoJGJyYW5jaCBhcyAmJG5vZGUpIHsKICAgICAgICBpZiAoaXNfYXJyYXkoJG5vZGUpKSB7CiAgICAgICAgICAgIC8vINCV0YHQu9C4INGDINC90LDRgSDQstC70L7QttC10L3QvdGL0Lkg0LzQsNGB0YHQuNCyCiAgICAgICAgICAgIHdhbGtBcm91bmRUaGVUcmVlKCRub2RlKTsKICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAvLyDQldGB0LvQuCDRh9C40YHQu9C+CiAgICAgICAgICAgICRub2RlID0gJG5vZGUgKiAyOwogICAgICAgIH0KICAgIH0KfQoKdmFyX2R1bXAoJHRyZWUpOwp3YWxrQXJvdW5kVGhlVHJlZSgkdHJlZSk7CnZhcl9kdW1wKCR0cmVlKTs=