0

I am pritty new to PHP and there are a lot of thinks i still dont know.

What the problem is that i dont understand the purpuse of the case statement another words what does it do and how u r suppose to use it.

3
Contributors
3
Replies
4
Views
12 Years
Discussion Span
Last Post by ashneet
0

PHP's switch/case statement is like a big if/elseif/else statement. I use it all the time. I think the PHP documentation explains it well--not sure I can make it more clear.
http://www.php.net/manual/en/control-structures.switch.php

You don't have to use switch/case--you can use if/elseif/else instead, but switch/case is cleaner. Also, switch/case allows you to setup conditions where more than one test is true so multiple case sections fire--although I've never done this in my thousands of lines of PHP code.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.