<?php
// your code goes here
function makeRandomizerWithMemory() {
$getValue = function($key) use (&$memory) {
}
return $memory[$key];
};
return function($arg = null) use ($getValue) {
if ($arg) {
return $getValue($arg);
}
};
}
$getRand = makeRandomizerWithMemory();
$args = array('sobaka', 'kot', 12345, null);
foreach ($args as $arg) {
echo "{$arg}: {$getRand($arg)}\n";
echo "{$arg}: {$getRand($arg)}\n\n";
}
PD9waHAKIAovLyB5b3VyIGNvZGUgZ29lcyBoZXJlCmZ1bmN0aW9uIG1ha2VSYW5kb21pemVyV2l0aE1lbW9yeSgpIHsKCSRtZW1vcnkgPSBhcnJheSgpOwoJJGdldFZhbHVlID0gZnVuY3Rpb24oJGtleSkgdXNlICgmJG1lbW9yeSkgewoJCWlmICghYXJyYXlfa2V5X2V4aXN0cygka2V5LCAkbWVtb3J5KSkgewoJCQkkbWVtb3J5WyRrZXldID0gbXRfcmFuZCgpOwoJCX0KCQlyZXR1cm4gJG1lbW9yeVska2V5XTsKCX07CglyZXR1cm4gZnVuY3Rpb24oJGFyZyA9IG51bGwpIHVzZSAoJGdldFZhbHVlKSB7CgkJaWYgKCRhcmcpIHsKCQkJJGtleSA9IHN0cnZhbCgkYXJnKTsKCQkJcmV0dXJuICRnZXRWYWx1ZSgkYXJnKTsKCQl9CgkJcmV0dXJuIG10X3JhbmQoKTsKCX07Cn0KCiRnZXRSYW5kID0gbWFrZVJhbmRvbWl6ZXJXaXRoTWVtb3J5KCk7CgokYXJncyA9IGFycmF5KCdzb2Jha2EnLCAna290JywgMTIzNDUsIG51bGwpOwoKZm9yZWFjaCAoJGFyZ3MgYXMgJGFyZykgewoJZWNobyAieyRhcmd9OiB7JGdldFJhbmQoJGFyZyl9XG4iOwoJZWNobyAieyRhcmd9OiB7JGdldFJhbmQoJGFyZyl9XG5cbiI7Cn0=