How to change the length of excerpt() method?

The top answer to this question handles dynamically altering the length of your excerpt using a custom excerpt function.

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