Page 1 of 1

Select Case

Posted: Fri Feb 13, 2004 6:54 am
by jaynakus
Hi there
Select case is used in many lanuages
I am new to web designing and php but know many about other programming lang's.
So i want to use select case in php. I could not find in php.net so i had to register here :). I hope some one will help me
thnx
Best wishes to all programmers

Posted: Fri Feb 13, 2004 7:21 am
by dethron
Do you mean 'switch-case'.

http://tr2.php.net/manual/en/control-st ... switch.php

Code: Select all

<?php
if ($i == 0) {
   echo "i equals 0";
} elseif ($i == 1) {
   echo "i equals 1";
} elseif ($i == 2) {
   echo "i equals 2";
}

switch ($i) {
case 0:
   echo "i equals 0";
   break;
case 1:
   echo "i equals 1";
   break;
case 2:
   echo "i equals 2";
   break;
}
?>

Posted: Fri Feb 13, 2004 7:44 am
by jaynakus
Thanx buddy now I can go on working on my work
I was stumbled by this thing