public static function _try(callable $f) {
        try {
            return Result::success($f());
        }
        catch( \Exception $error ) {
            return Result::error($error);
        }
    }
public static function _try(callable $f) {
        try {
            return Result::success($f());
        }
        catch( \Exception $error ) {
            return Result::error($error);
        }
    }
public static function _try ( callable $ f ) { try { return Result :: success ( $ f ( ) ) ; } catch ( \ Exception $ error ) { return Result :: error ( $ error ) ; } }
Tries to execute the given function and returns a result representing the
outcome, i.e. if the function returns normally, a successful result is
returned containing the return value and if the function throws an exception,
an error result is returned containing the error

$f should take no arguments and return a value that will be wrapped in a
success if the computation completes successfully

The _ is required if we want to use the word try since it is keyword
Tries to execute the given function and returns a result representing the outcome i . e . if the function returns normally a successful result is returned containing the return value and if the function throws an exception an error result is returned containing the error