I am calling functions using dynamic function names (something like this)
$unsafeFunctionName = $_POST[\'function_name\']; $safeFunctionName = safe($unsafe
In order to use the output value, if present, or the return value if not, you could simply modify your code like this:
ob_start(); $return_val = $safeFunctionName(); $echo_val = ob_get_clean(); $result = "" . (strlen($echo_val) ? $echo_val : $return_val) . "";