Is storing in a variable the result of a fonction a most powerful way to code an if structures in WordPress?

Is storing in a variable the result of a fonction a most powerful way to code an if structures in WordPress?

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)