Select Case

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
jaynakus
Forum Newbie
Posts: 2
Joined: Fri Feb 13, 2004 6:54 am
Location: istanbul
Contact:

Select Case

Post 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
User avatar
dethron
Forum Contributor
Posts: 370
Joined: Sat Apr 27, 2002 11:39 am
Location: Istanbul

Post 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;
}
?>
jaynakus
Forum Newbie
Posts: 2
Joined: Fri Feb 13, 2004 6:54 am
Location: istanbul
Contact:

Post by jaynakus »

Thanx buddy now I can go on working on my work
I was stumbled by this thing
Post Reply