-
February 27th, 2007, 12:34 PM
#1
Senior Member
PHP 'switch' statement
Hi guys
I'm a bit confused with the 'switch' statement.
The main thing I need to know is whether it takes multiple agruments like:
switch ($one, $two, $three) {
case $one == 1;
case $two == 2;
case $three == 3;
}
or will it be to write it:
switch (TRUE){
case $one == 1;
case $two == 2;
case $three == 3;
}
I've seen the second example in the comments to some tutorials.
Don\'t post if you\'ve got nothing constructive to say. Flooding is annoying
-
February 27th, 2007, 01:26 PM
#2
Junior Member
Hi,
The switch statement can only be used to compare the value of one variable.
And it is used in this way: http://pt.php.net/switch
If you want to check the value of multiple vars use the if statement.
-
February 27th, 2007, 01:47 PM
#3
Senior Member
Originally Posted by hknetmaster
Hi,
The switch statement can only be used to compare the value of one variable.
And it is used in this way: http://pt.php.net/switch
If you want to check the value of multiple vars use the if statement.
Well, I thought about it, but then decided to research switch as well, as it might come useful
I also read a number of tutorials on the subject, but in my experience these are always writen as simple as possible and it's hard to find anything to advanced without asking on the forums such as this one
Don\'t post if you\'ve got nothing constructive to say. Flooding is annoying
Similar Threads
-
By nightcat in forum The Security Tutorials Forum
Replies: 9
Last Post: May 28th, 2005, 02:47 AM
-
By SDK in forum Web Security
Replies: 19
Last Post: December 20th, 2004, 05:31 PM
-
By Vorlin in forum Other Tutorials Forum
Replies: 3
Last Post: June 15th, 2004, 10:25 PM
-
By HDD in forum Other Tutorials Forum
Replies: 2
Last Post: February 1st, 2004, 08:05 PM
-
By Noble Hamlet in forum AntiOnline's General Chit Chat
Replies: 1100
Last Post: March 17th, 2002, 09:38 AM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|