note 90618 deleted from control-structures.switch by danbrown
| From: | danbrown@php.net | Date: | Thu, 30 Apr 2009 16:51:25 +0000 |
| Subject: | note 90618 deleted from control-structures.switch by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-154056@lists.php.net to get a copy of this message | ||
Note Submitter: mevlutsafi at hotmail dot com
----
Its weird but when I dont add break; after switch{} statement, page keeps reloading (twice in my
case).
This example keeps reloading the page and switch statement again:
<?php
$op="sponsor";
switch($op) {
case "sponsor":
echo"sponsor";
break;
default:
include("index.php");
break;
}
?>
this double echos sponsor!
if I add a break after the switch then it really breaks!
<?php
$op="sponsor";
switch($op) {
case "sponsor":
echo"sponsor";
break;
default:
include("index.php");
break;
}
break;
?>
This would be helpfull if you navigate your site by switch funtion and you need to include a case
into a div via ajax.