note 110688 deleted from control-structures.switch by aharvey

From: Date: Fri, 23 Nov 2012 01:43:48 +0000
Subject: note 110688 deleted from control-structures.switch by aharvey
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-192109@lists.php.net to get a copy of this message
Note Submitter: vadim dot romanko at gmail dot com ---- Alternative formating of the operator switch: <?php $i = rand(5); echo "Random: i is $i <br>"; switch($i){ default: echo "Switch to: default"; break;case 1: echo "Switch to: case 1"; break;case 2:; echo "Switch to: case 2"; break;case 3:; echo "Switch to: case 3"; } ?> Benefits: 1. Use one keyword: break;case so never lose break. 2. The default option first. 3. Clean and compact syntax, contains no unnecessary distractions designs.

« previous php.notes (#192109) next »