I was wondering what is better or more accepted when coding in PHP. I was taught, in Java, that class methods to get and set variables should be prefixed with "get" and "set". What I want to know, though, is should I use these prefixes on regular PHP functions.
For example, to retrieve a username from a session variable I would either have
getUsername()
or
username()
What are the advantages and best practices. I know that using "get" is more mnemonic but it's rather redundant (especially for a personal project that I don't expect to be having other people read) but for the sake of good practice I would like to get it right.
While I'm at it, what is the proper naming convention for variables? Underscore-separated or camel-case? I've looked around and I've seen a mix of both. Wordpress tends to use underscores in their function names but a lot of other sites say camel-case is best.