PHP Experiment 2

Source: Internet
Author: User

1, output the following statements to the results

The <?php//While statement applies $i = 1;while ($i <=) {   echo $i;   if ($i <)       echo "";   ElseIf ($i% = = 0)      echo "<br/>\n";   else      echo "";   $i + +;} echo "<br/>\n";//do...while statement Applied $i = 1;do {   echo $i;   if ($i <)       echo "";   ElseIf ($i% = = 0)      echo "<br/>\n";   else      echo "";   $i + +;} while ($i <= 20);? >

2. Output the results of the following files include.php and require.php

File Inc1.inc

<?php $var 1 = "This is the value of a variable in the Inc1.inc file!<br>"; if (Isset ($int)) {  $int + +;} else{$int = 1;}? >

File inc2.in

<?PHP$VAR2 = "This is the value of a variable in the Inc2.inc file!<br>";? >

File include.php

File require.php Content

3. Use the dual for loop to dynamically create a table and change the background color of the odd and even rows alternately,

Tables generated through a for loop
1th Row 1th Column 1th Row 2nd Column 1th Row 3rd Column
2nd row 1th Column 2nd row 2nd Column 2nd row 3rd Column
3rd row 1th Column 3rd row 2nd Column 3rd row 3rd Column
4th row 1th Column 4th row 2nd Column 4th row 3rd Column
5th Row 1th Column 5th row 2nd Column 5th row 3rd Column

PHP Experiment 2

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.