944,017 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 1791
  • PHP RSS
Jul 24th, 2005
0

Case Help

Expand Post »
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.
Similar Threads
Reputation Points: 10
Solved Threads: 1
Junior Poster
ashneet is offline Offline
147 posts
since Jun 2005
Jul 24th, 2005
0

Re: Case Help

Case by itself serves little or no purpose. I think you're looking for the switch function, instead.
Reputation Points: 14
Solved Threads: 0
Light Poster
Sp!ke is offline Offline
45 posts
since Jul 2005
Jul 24th, 2005
0

Re: Case Help

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...res.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.
Reputation Points: 36
Solved Threads: 6
Posting Whiz
Troy is offline Offline
354 posts
since Jun 2005
Jul 24th, 2005
0

Re: Case Help

Thanks Makes more sense now with the PHP documentation.
Reputation Points: 10
Solved Threads: 1
Junior Poster
ashneet is offline Offline
147 posts
since Jun 2005

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: Securely Allow users to add to Database
Next Thread in PHP Forum Timeline: help with creating form counter





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC