In this line:
function username() { return !empty($this->data['username']) ? $this->data['username'] : '(no name!)';
What does the question mark and the colon mean or represent?
it's a uniary(sp?) operator. Basically, (using your example)
if(!empty($this->_data['username']) { $this->_data['username']; } else { '(no name!)'; }
but it's easier to read (if used properly). I'm not sure if there's a speed benefit or not.
HTH
ternary operator
Originally posted by kidsleep it's a uniary(sp?) operator.
sp: Ternary (so called because there are three operands).
And just to correct a small typo:
if(!empty($this->_data['username']) { return $this->_data['username']; } else { return '(no name!)'; }
http://www.php.net/manual/en/language.operators.comparison.php