View Single Post
07-30-2012, 05:05 AM
#6
unikorndesigns is offline unikorndesigns
unikorndesigns's Avatar
Status: Junior Member
Join date: May 2011
Location:
Expertise: Web Designing and Development
Software: Photoshop, Dreamweaver and etc
 
Posts: 41
iTrader: 0 / 0%
 

unikorndesigns is on a distinguished road

  Old

ok...since the purpose of this question is not exposed, the way i see it....u wanted 1function to serve the purpose all the 3 functions you mentioned top???

and if so...its simple...!

PHP Code:
function userdetails($user,$item)
{
    if(
$user == null)
        return 
"<del>deleted</del>";
    else
    {
        switch(
$item)
        {
            case 
'1':
                return 
"<a href=/user/".strtolower($user).">$user</a>";
            break;

            case 
'2':
                return 
$username;
            break;

            default:
                return 
$user;
            break;
        };
    }


$item holds the number for the cases.....so using one function with 2 parameters you can output any detail you want...and easy to add more details for accessing, just introduce another case to the switch loop...tc

HOPE I HAVE HELPED YOU!!