View Single Post
06-04-2012, 10:09 PM
#1
Dan is offline Dan
Dan's Avatar
Status: Request a custom title
Join date: Feb 2005
Location:
Expertise:
Software:
 
Posts: 3,164
iTrader: 15 / 86%
 

Dan is an unknown quantity at this point

  Old  How could I merge these three functions?

Self explanatory.

PHP Code:
function username($user) {
    if(
$user == null)
        return 
"<del>deleted</del>";
    else
        return 
$user;
}

function 
userURL($user) {
    if(!
$user == null)
        return 
"/user/".strtolower($user);
}

function 
userlink($user) {
    if(
$user == null)
        return 
"<del>deleted</del>";
    else
        return 
"<a href=/user/".strtolower($user).">$user</a>";

I don't see the need for three different functions when I could probably merge these into one. Though I'm not particularly sure how. If someone could point me in the right direction that would be swell.