Jump to content

Php "Function Tree" Idea


binarystorm

Recommended Posts

Im slowing making a simple CMS for my website, called VCMS. It has a core php file called vcmsCORE.php and sensory components can access the CORE which is composed of a bunch of functions. SO basically in the html of a page you just add <? funct_name($var,$var2); ?> and it will spit out a username or whatever.

So Im writing a function that accepts a userID (basically the id of the users table in mysql) and the function spits out the correlating information to make a little "profile page."  And since a function can only return one variable at a time I was wondering if this idea of mine would work - a function "tree" if you like:

function profilePage_MyPersonalProfile($userId,$option)

{

    if($option == 1){

          echo"Fred";

    }

    if($option == 2){

          echo"[email protected]";

    }

}

Thats it basically. IS that the best way to do it? Or is there a more efficient way.

Thanks, Im new at php and just thought this up, hopefully logically.

Link to comment
https://forums.phpfreaks.com/topic/111422-php-function-tree-idea/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.