function &first() { if (!$this->isEmpty()) { $aKeys = $this->keys(); return $this->aCollection[array_shift($aKeys)]; } $var = null; # two lines instead of one return $var; # as PHP needs a variable to return by ref }