note 55866 deleted from functions.arguments by victor

From: Date: Tue, 16 Aug 2005 08:06:04 +0000
Subject: note 55866 deleted from functions.arguments by victor
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-93711@lists.php.net to get a copy of this message
Note Submitter: MarcM ---- You can use a function argument as a switch to give you different returns from the same input. function mypagefunction($page, $switch){ switch ($page){ case 'home': $pageinclude = "home.php"; $pagetitle = "This is my home page!"; break; case 'contact': $pageinclude = "contact.php"; $pagetitle = "This is my contact page!"; break; } if ($switch == 1){ return $pageinclude; }else{ return $pagetitle; } } This keeps certain data together in one multi-purpose function. You can modify it for as many uses as needed. example, you could ad keywords for each page, and then call the function for page specific meta-tags. Maybe this will help someone. It works for me!

« previous php.notes (#93711) next »