note 70788 deleted from control-structures.switch by crell
| From: | crell@php.net | Date: | Mon, 27 Jun 2022 20:36:20 +0000 |
| Subject: | note 70788 deleted from control-structures.switch by crell | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-218629@lists.php.net to get a copy of this message | ||
Note Submitter:
----
I could have used a swich for this, but I found that using the array was much faster.
$action = $_GET['action'];
$pages = array
(
'edit' => './edit.php',
'search' => './search.php'
);
if(strlen($pages[$action]) > 0)
{
require $pages[$action];
}
else
{
require './default.php';
}