Premiere Pro CS4 Download PHP4 practical application Experience Chapter 7

Source: Internet
Author: User
Author: Sun Sports
Another type of "if-else" family control statement function is almost the same as the PHP "switch" statement. It looks as follows:
--------------------------------------------------------------------------------
Switch (decision variable)
{
The first condition of case is correct:
Do this!
The second condition of case is correct:
Do this!
The third condition of case is correct:
Do this!
... Wait a minute...
}
--------------------------------------------------------------------------------
We will use the "switch" statement to rewrite the above example of the lucky cookie to make these notes clearer:
[cookie.php]
--------------------------------------------------------------------------------
<?
The decision variable here is the date selected by the user
Switch ($day)
{
First case
Case "Monday":
$fortune = "Do not make it simple and effective when you can find a complex and wonderful way to make everything happen";
Break
The second case
Case "Tuesday":
$fortune = "Life is the bridge of the game?"-you must have some kind of inventions. ";
Break
The third case
Case "Wednesday":
$fortune = "What makes a sane person live in this world and never go mad?" ";
Break
Fourth case
Case "Thursday":
$fortune = "Don't be crazy, be funny";
Break
Fourth case
Case "Friday":
$fortune = "Just follow the times, along the lines of the atmosphere, and when you get promoted you will find that the type is a demon." ";
Break
If none of the above conditions are met ...
Default
$fortune = "Sorry, the weekend is closed";
Break
}
?>
< html>
< head>
< Basefont face= "Arial" >
< body>
Is this your <? Echo $day;?> 's lucky words:
< br>
< b><? echo $fortune;?></b>
</body>
--------------------------------------------------------------------------------
There are two important keywords: the keyword "break" is used to interrupt the "switch" statement structure and immediately moves out of the structure block, and then runs the row immediately following the block. The "default" keyword is used to execute statements that are set when a variable passed to "switch" does not conform to any of the cases enumerated in the statement structure.

The above describes the premiere pro cs4 download PHP4 practical application Experience 7, including the premiere pro cs4 download content, want to be interested in PHP tutorial friends helpful.

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.