note 70788 added to control-structures.switch

From: Date: Fri, 27 Oct 2006 22:29:02 +0000
Subject: note 70788 added to control-structures.switch
Groups: php.notes 
Request: Send a blank email to php-notes+get-119195@lists.php.net to get a copy of this message
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'; } ---- Server IP: 216.194.113.175 Probable Submitter: 65.123.245.94 ---- Manual Page -- http://www.php.net/manual/en/control-structures.switch.php Edit -- https://master.php.net/note/edit/70788 Del: integrated -- https://master.php.net/note/delete/70788/integrated Del: useless -- https://master.php.net/note/delete/70788/useless Del: bad code -- https://master.php.net/note/delete/70788/bad+code Del: spam -- https://master.php.net/note/delete/70788/spam Del: non-english -- https://master.php.net/note/delete/70788/non-english Del: in docs -- https://master.php.net/note/delete/70788/in+docs Del: other reasons-- https://master.php.net/note/delete/70788 Reject -- https://master.php.net/note/reject/70788 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#119195) next »