note 83686 deleted from function.in-array by danbrown

From: Date: Mon, 08 Jun 2009 21:41:08 +0000
Subject: note 83686 deleted from function.in-array by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-156499@lists.php.net to get a copy of this message
Note Submitter: PeeHPee ---- <?php $pages = array('help', 'main', 'contact'); function isDefined($page) { return in_array($page, $pages, true); } $act = $_GET['act']; function loadPage() { if(isDefined($act)) include $act . '.php'; else include 'index.php'; } loadPage(); ?> Just wrote it so I could load pages, and if they're not defined in the array, I can load the default page.

« previous php.notes (#156499) next »