note 38106 added to control-structures.switch
| From: | jon at rn2 dot php dot net | Date: | Mon, 08 Dec 2003 17:48:28 +0000 |
| Subject: | note 38106 added to control-structures.switch | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-61654@lists.php.net to get a copy of this message | ||
In response to the entry by "kriek at jonkriek dot com", I think you would probably be
better of doing this:
<?php
// ensure $_GET['go'] is set, an integer, and not 0
// then, set nav number; default to 1
$nav = ( isset($_GET['go']) && (intval($_GET['go']) ==
$_GET['go']) && $_GET['go'] ) ?
intval($_GET['go']) : 1;
// format navigation string and include
include(sprintf("Page%02d.php",$nav));
?>
... as oppposed to the switch setup you recommended, which is limited to the number of cases you
specify...
----
Manual Page -- http://www.php.net/manual/en/control-structures.switch.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+38106
Delete -- http://master.php.net/manage/user-notes.php?action=delete+38106&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+38106&report=yes
Search -- http://master.php.net/manage/user-notes.php