$func = 'trim';
if (function_exists($func)) echo call_user_func($func,' Test ');
$_POST['function'] = 'trim';
$array = [' a', 'b '];
$allowedFunctions = ['trim'];
if (function_exists($_POST['function']) && in_array($_POST['function'], $allowedFunctions)) {
$results = array_map($_POST['function'], $array);
print_r($results);
}