PHP self-taught 4--using functions to output array data to an HTML table tag (use the example of a function)

Source: Internet
Author: User

This section actually tells the truth and there is no dry food, but in order to prevent the PO Master lazy cancer Recurrence, or stick to put something, even the content and length are heinous. This section is implemented by a function to display the contents of the array in the table label of the output HTML.

function files--createtables.php file:

<?PHP//convert data in array to the element displayed in HTML ' s table tagfunctionCreate_tables ($DATAARR,$border=1,$cellpadding=4,$cellspacing=2,$bgcolor= "#FFFFFF"){    Echo"<table border=\" ".$border. "\" Cellpadding=\ "".$cellpadding. "\" Cellspacing=\ "".$cellspacing. "\" Bgcolor=\ "".$bgcolor. "\""; Reset($DATAARR); $value= Current($DATAARR);  while($value){        Echo"<tr><td>".$value. "</tr></td>"; $value=Next($DATAARR); }    Echo"</table>";}//Create the spam data for displaying$DATAARR=Array("Apple", "pear", "orange");//Call the functionCreate_tables ($DATAARR, 2, 4, 2, "#CCCCCC");?>

Display effect:

Revised on 2016/3/9 by Mustang fungus

PHP self-taught 4--using functions to output array data to an HTML table tag (use the example of a function)

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.