/Upload/documents/handbook/php/php-cool/php-alternative-syntax-for-flow-control.html
HTML | 222 lines | 215 code | 7 blank | 0 comment | 0 complexity | 4a2491146a1f6c5861b347741d64e96a MD5 | raw file
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
- <html>
- <head>
- <title>The DoYouHaoBaby PHP Framework For PHP5 | ????????</title>
- <meta http-equiv="content-type" content="text/html; charset=gbk" />
- <meta name="Author" content="???Dyhb">
- <meta name="Keywords" content="DoYouHaoBaby,Framework">
- <meta name="Description" content="The DoYouHaoBaby PHP Framework | ?????????????">
- <link rel="stylesheet" type="text/css" href="./../../media/css/style.css" />
- <link rel="stylesheet" type="text/css" href="./../../media/css/highlight.css" />
- </head>
- <body style="margin:0">
- <div id="header"><img src="./../../media/images/logo.png" border="0" title="The DoYouHaoBaby PHP Framework Logo" ></div>
- <div id="content">
- <div id="version">
- The DoYouHaoBaby PHP Framework????????<br>
- Copyright(c) <a href="http://doyouhaobaby.net">DoYouHaoBaby.NET</a>
- All Rights Reserved.
- </div>
-
-
- <div class="menu">
- <table cellspacing=0 cellpadding=0 width="95%" border=0>
- <tbody>
- <tr>
- <th align=middle colspan=3>The DoYouHaoBaby PHP Framework????????</th>
- </tr>
- <tr>
- <td valign=bottom align=left width="25%">
- <a accesskey="p" href="../../index.html">??</a>?
- </td>
- <td valign=bottom align=middle width="50%">
- </td>
- <td valign=bottom align=right width="25%">
- <a accesskey="n" href="./index.html">??</a>
- </td>
- </tr>
- </tbody>
- </table>
- </div>
-
- <div id="box">
- <div class="title">[ PHP????????? ]</div>
- <div class="detail">
- <p>
- PHP ?????????PHP ?HTML??????????????????????????????????</p>
- <div class="title2">
- <span style="color: rgb(0, 0, 255);">1?PHP??????????</span></div>
- ???????if,while,forforeach,switch????????????</p>
- <div class="title2">
- <span style="color: rgb(0, 0, 255);">2???????????</span></div><p>
- ?????{??????:????????}????? endif;?endwhile;?endfor;?endforeach; ?? endswitch;</p>
- <p>
- ??????<br />
- <DIV class=dp-highlighter><DIV class=bar></DIV>
- <OL class=dp-c>
- <LI class=alt><SPAN><SPAN><?php </SPAN><SPAN class=vars>$sCompanyName</SPAN><SPAN> ='DoYouHaoBaby!';?> </SPAN></SPAN></LI>
- <LI><SPAN><?php </SPAN><SPAN class=keyword>if</SPAN><SPAN> ( !</SPAN><SPAN class=func>empty</SPAN><SPAN class=keyword>empty</SPAN><SPAN>( </SPAN><SPAN class=vars>$sCompanyName</SPAN><SPAN> ) ): ?> </SPAN></SPAN></LI>
- <LI class=alt><SPAN> DoYouHaoBaby ?????? </SPAN></LI>
- <LI><SPAN><?php </SPAN><SPAN class=keyword>endif</SPAN><SPAN>; ?> </SPAN></SPAN></LI></OL></DIV></p>
- <p>
- ????????<br />
- <DIV class=dp-highlighter><DIV class=bar></DIV>
- <OL class=dp-c>
- <LI class=alt><SPAN><SPAN><?php </SPAN><SPAN class=vars>$sCompanyName</SPAN><SPAN> ='DoYouHaoBaby!';?> </SPAN></SPAN></LI>
- <LI><SPAN><?php </SPAN><SPAN class=keyword>if</SPAN><SPAN> ( !</SPAN><SPAN class=func>empty</SPAN><SPAN class=keyword>empty</SPAN><SPAN>( </SPAN><SPAN class=vars>$sCompanyName</SPAN><SPAN> ) ){ ?> </SPAN></SPAN></LI>
- <LI class=alt><SPAN> DoYouHaoBaby ?????? </SPAN></LI>
- <LI><SPAN><?php } ?> </SPAN></LI></OL></DIV></p>
- <p>
- ????????????????????<br />
- <DIV class=dp-highlighter><OL class=dp-c>
- <LI class=alt><SPAN><SPAN>DoYouHaoBaby ?????? </SPAN></SPAN></LI></OL></DIV></p>
- <p>
- ???<br />
- <img src="./../../media/images/php-alternative-syntax-for-flow-control.jpg" border="0" /></p>
- <div class="title2">
- <span style="color: rgb(0, 0, 255);">3????????</span></div><p>
- ?PHP?HTML???????????????</p>
- <ul>
- <li>
- ?HTML?PHP????????????? </li>
- <li>
- ?????????????????</li>
- <li>
- ???ASP????basic????????????????PHP?</li>
- </ul><div class="title2">
- <span style="color: rgb(0, 0, 255);">4?if???????</span></div><br />
- <DIV class=dp-highlighter><DIV class=bar></DIV>
- <OL class=dp-c>
- <LI class=alt><SPAN><SPAN><?php </SPAN><SPAN class=vars>$sCompanyName</SPAN><SPAN> ='DoYouHaoBaby';?> </SPAN></SPAN></LI>
- <LI><SPAN><?php </SPAN><SPAN class=keyword>if</SPAN><SPAN> ( </SPAN><SPAN class=vars>$sCompanyName</SPAN><SPAN> == 'Micorsoft' ): ?> </SPAN></SPAN></LI>
- <LI class=alt><SPAN><div>Micorsoft( ???? )</div> </SPAN></LI>
- <LI><SPAN><?php </SPAN><SPAN class=keyword>elseif</SPAN><SPAN> ( </SPAN><SPAN class=vars>$sCompanyName</SPAN><SPAN> =='Google'): ?> </SPAN></SPAN></LI>
- <LI class=alt><SPAN><div>Google( ?? )</div> </SPAN></LI>
- <LI><SPAN><?php </SPAN><SPAN class=keyword>else</SPAN><SPAN>: ?> </SPAN></SPAN></LI>
- <LI class=alt><SPAN><div>The DoYouHaoBaby Company( ??? )</div> </SPAN></LI>
- <LI><SPAN><?php </SPAN><SPAN class=keyword>endif</SPAN><SPAN>; ?> </SPAN></SPAN></LI></OL></DIV> </p>
- <p>
- ???????<br />
- <DIV class=dp-highlighter><OL class=dp-c>
- <LI class=alt><SPAN><SPAN>The DoYouHaoBaby Company( ??? ) </SPAN></SPAN></LI></OL></DIV></p>
- <p>
- ???<br />
- <img src="./../../media/images/php-alternative-syntax-for-flow-control2.jpg" border="0" /></p>
- <div class="title2">
- <span style="color: rgb(0, 0, 255);">5?while?????</span></div><br />
- <DIV class=dp-highlighter><DIV class=bar></DIV>
- <OL class=dp-c>
- <LI class=alt><SPAN><SPAN><?php </SPAN><SPAN class=vars>$nI</SPAN><SPAN>=0;?> </SPAN></SPAN></LI>
- <LI><SPAN><?php </SPAN><SPAN class=keyword>while</SPAN><SPAN> ( </SPAN><SPAN class=vars>$nI</SPAN><SPAN><10 ): ?> </SPAN></SPAN></LI>
- <LI class=alt><SPAN><?php </SPAN><SPAN class=vars>$nI</SPAN><SPAN>++;?> </SPAN></SPAN></LI>
- <LI><SPAN><li>( <?php </SPAN><SPAN class=func>echo</SPAN><SPAN> </SPAN><SPAN class=vars>$nI</SPAN><SPAN>;?> ): The DoYouHaoBaby !</li> </SPAN></SPAN></LI>
- <LI class=alt><SPAN><?php </SPAN><SPAN class=keyword>endwhile</SPAN><SPAN>; ?> </SPAN></SPAN></LI></OL></DIV></p>
- <p>
- ???????<br />
- <DIV class=dp-highlighter><OL class=dp-c>
- <LI class=alt><SPAN><SPAN>( 1 ): The DoYouHaoBaby ! </SPAN></SPAN></LI>
- <LI><SPAN>( 2 ): The DoYouHaoBaby ! </SPAN></LI>
- <LI class=alt><SPAN>( 3 ): The DoYouHaoBaby ! </SPAN></LI>
- <LI><SPAN>( 4 ): The DoYouHaoBaby ! </SPAN></LI>
- <LI class=alt><SPAN>( 5 ): The DoYouHaoBaby ! </SPAN></LI>
- <LI><SPAN>( 6 ): The DoYouHaoBaby ! </SPAN></LI>
- <LI class=alt><SPAN>( 7 ): The DoYouHaoBaby ! </SPAN></LI>
- <LI><SPAN>( 8 ): The DoYouHaoBaby ! </SPAN></LI>
- <LI class=alt><SPAN>( 9 ): The DoYouHaoBaby ! </SPAN></LI>
- <LI><SPAN>( 10 ): The DoYouHaoBaby ! </SPAN></LI></OL></DIV></p>
- <p>
- ???<br />
- <img src="./../../media/images/php-alternative-syntax-for-flow-control3.jpg" border="0" /></p>
-
- <br /><div class="title2">
- <span style="color: rgb(0, 0, 255);">6?for?????</span></div><br />
- <DIV class=dp-highlighter><DIV class=bar></DIV>
- <OL class=dp-c>
- <LI class=alt><SPAN><SPAN><?php </SPAN><SPAN class=keyword>for</SPAN><SPAN> ( </SPAN><SPAN class=vars>$nI</SPAN><SPAN>=0;; </SPAN><SPAN class=vars>$nI</SPAN><SPAN><10; </SPAN><SPAN class=vars>$nI</SPAN><SPAN>++ ): ?> </SPAN></SPAN></LI>
- <LI><SPAN><li>( <?php </SPAN><SPAN class=func>echo</SPAN><SPAN> </SPAN><SPAN class=vars>$nI</SPAN><SPAN>;?> ):DoYouHaoBaby( ??? )</li> </SPAN></SPAN></LI>
- <LI class=alt><SPAN><?php </SPAN><SPAN class=keyword>endfor</SPAN><SPAN>; ?> </SPAN></SPAN></LI></OL></DIV></p>
- <p>
- ???????<br />
- <DIV class=dp-highlighter><OL class=dp-c>
- <LI class=alt><SPAN><SPAN>( 0 ):DoYouHaoBaby( ??? ) </SPAN></SPAN></LI>
- <LI><SPAN>( 1 ):DoYouHaoBaby( ??? ) </SPAN></LI>
- <LI class=alt><SPAN>( 2 ):DoYouHaoBaby( ??? ) </SPAN></LI>
- <LI><SPAN>( 3 ):DoYouHaoBaby( ??? ) </SPAN></LI>
- <LI class=alt><SPAN>( 4 ):DoYouHaoBaby( ??? ) </SPAN></LI>
- <LI><SPAN>( 5 ):DoYouHaoBaby( ??? ) </SPAN></LI>
- <LI class=alt><SPAN>( 6 ):DoYouHaoBaby( ??? ) </SPAN></LI>
- <LI><SPAN>( 7 ):DoYouHaoBaby( ??? ) </SPAN></LI>
- <LI class=alt><SPAN>( 8 ):DoYouHaoBaby( ??? ) </SPAN></LI>
- <LI><SPAN>( 9 ):DoYouHaoBaby( ??? ) </SPAN></LI></OL></DIV></p>
- <p>
- ???<br />
- <img src="./../../media/images/php-alternative-syntax-for-flow-control4.jpg" border="0" /></p>
- <div class="title2">
- <span style="color: rgb(0, 0, 255);">7?foreach?????</span></div><br />
- <DIV class=dp-highlighter><DIV class=bar></DIV>
- <OL class=dp-c>
- <LI class=alt><SPAN><SPAN><?php </SPAN><SPAN class=vars>$arrList</SPAN><SPAN> =</SPAN><SPAN class=keyword>array</SPAN><SPAN>( 'english'=>'DoYouHaoBaby','chinese'=>'???' );?> </SPAN></SPAN></LI>
- <LI><SPAN><?php </SPAN><SPAN class=keyword>foreach</SPAN><SPAN> ( </SPAN><SPAN class=vars>$arrList</SPAN><SPAN> </SPAN><SPAN class=keyword>as</SPAN><SPAN> </SPAN><SPAN class=vars>$key</SPAN><SPAN> => </SPAN><SPAN class=vars>$value</SPAN><SPAN> ): ?> </SPAN></SPAN></LI>
- <LI class=alt><SPAN><li><?php </SPAN><SPAN class=func>echo</SPAN><SPAN> </SPAN><SPAN class=vars>$key</SPAN><SPAN>;?>-<?php </SPAN><SPAN class=func>echo</SPAN><SPAN> </SPAN><SPAN class=vars>$value</SPAN><SPAN>;?></li> </SPAN></SPAN></LI>
- <LI><SPAN><?php </SPAN><SPAN class=keyword>endforeach</SPAN><SPAN>; ?> </SPAN></SPAN></LI></OL></DIV> </p>
- <p>
- ???????<br />
- <DIV class=dp-highlighter><OL class=dp-c>
- <LI class=alt><SPAN><SPAN>english-DoYouHaoBaby </SPAN></SPAN></LI>
- <LI><SPAN>chinese-??? </SPAN></LI></OL></DIV></p>
- <p>
- ???<br />
- <img src="./../../media/images/php-alternative-syntax-for-flow-control5.jpg" border="0" /></p>
- <div class="title2">
- <span style="color: rgb(0, 0, 255);">8?switch?????</span></div>
- <p>
- <DIV class=dp-highlighter><DIV class=bar></DIV>
- <OL class=dp-c>
- <LI class=alt><SPAN><SPAN><?php </SPAN></SPAN></LI>
- <LI><SPAN></SPAN><SPAN class=vars>$nI</SPAN><SPAN> = 1; </SPAN></SPAN></LI>
- <LI class=alt><SPAN></SPAN><SPAN class=keyword>switch</SPAN><SPAN> ( </SPAN><SPAN class=vars>$nI</SPAN><SPAN> ): </SPAN></SPAN></LI>
- <LI><SPAN> </SPAN><SPAN class=keyword>case</SPAN><SPAN> 0: </SPAN></SPAN></LI>
- <LI class=alt><SPAN> </SPAN><SPAN class=func>echo</SPAN><SPAN> </SPAN><SPAN class=string>"DoYouHaoBaby is zero !"</SPAN><SPAN>; </SPAN></SPAN></LI>
- <LI><SPAN> </SPAN><SPAN class=keyword>break</SPAN><SPAN>; </SPAN></SPAN></LI>
- <LI class=alt><SPAN> </SPAN><SPAN class=keyword>case</SPAN><SPAN> 1: </SPAN></SPAN></LI>
- <LI><SPAN> </SPAN><SPAN class=func>echo</SPAN><SPAN> </SPAN><SPAN class=string>"DoYouHaoBaby is first !"</SPAN><SPAN>; </SPAN></SPAN></LI>
- <LI class=alt><SPAN> </SPAN><SPAN class=keyword>break</SPAN><SPAN>; </SPAN></SPAN></LI>
- <LI><SPAN> </SPAN><SPAN class=keyword>case</SPAN><SPAN> 2: </SPAN></SPAN></LI>
- <LI class=alt><SPAN> </SPAN><SPAN class=func>echo</SPAN><SPAN> </SPAN><SPAN class=string>"DoYouHaoBaby is second !"</SPAN><SPAN>; </SPAN></SPAN></LI>
- <LI><SPAN> </SPAN><SPAN class=keyword>break</SPAN><SPAN>; </SPAN></SPAN></LI>
- <LI class=alt><SPAN> </SPAN><SPAN class=keyword>default</SPAN><SPAN>: </SPAN></SPAN></LI>
- <LI><SPAN> </SPAN><SPAN class=func>echo</SPAN><SPAN> </SPAN><SPAN class=string>"DoYouHaoBaby is third !"</SPAN><SPAN>; </SPAN></SPAN></LI>
- <LI class=alt><SPAN> </SPAN><SPAN class=keyword>endswitch</SPAN><SPAN>; </SPAN></SPAN></LI>
- <LI><SPAN>?> </SPAN></LI></OL></DIV></p>
- <p>
- ???????<br />
- <DIV class=dp-highlighter><OL class=dp-c>
- <LI class=alt><SPAN><SPAN>DoYouHaoBaby is first ! </SPAN></SPAN></LI></OL></DIV></p>
- <p>
- ???<br />
- <img src="./../../media/images/php-alternative-syntax-for-flow-control6.jpg" border="0" /></p>
-
- </div>
- </div>
-
- <div class="menu">
- <table cellspacing=0 cellpadding=0 width="95%" border=0>
- <tbody>
- <tr>
- <td valign=top align=middle width="34%">
- <a accesskey="h" href="../../index.html">??</a>
- </td>
- </tr>
- <tr>
- <td valign=top align=middle width="34%">
- <a accesskey="u" href="./index.html">??</a>
- </td>
- </tr>
- </tbody>
- </table>
- </div>
-
- </div>
- <div id="footer">Copyright (c) <a href="http://doyouhaobaby.net" title="The DoYouHaoBaby Framework" >DoYouHaoBaby</a> All rights reserved.?</div>
- </body>
- </html>