Php converts each column in an HTML table into an array to collect table data _ PHP Tutorial

Source: Internet
Author: User
Php converts each column in an HTML table into an array to collect table data. Php converts each column in an HTML table into an array to collect table data. This document describes how php converts each column in an HTML table into an array to collect table data. How to collect table data by converting each column in an HTML table into an array

This example describes how php converts each column in an HTML table into an array to collect table data. Share it with you for your reference. The details are as follows:

The following php code converts each row and column of an HTML table into an array to collect table data.

 ] *?> 'Si "," ", $ table); $ table = preg_replace ("'
 
  
] *?> 'Si "," ", $ table); $ table = preg_replace ("'
  
   
] *?> 'Si "," ", $ table); $ table = str_replace (""," {Tr} ", $ table); $ table = str_replace (""," {Td} ", $ table); // remove the HTML tag $ table = preg_replace (" '<[/!] *? [^ <>] *?> 'Si "," ", $ table); // remove the blank character $ table = preg_replace (" '([rn]) [s] + '","", $ table); $ table = str_replace ("", "", $ table); $ table = str_replace ("", "", $ table ); $ table = explode ('{tr}', $ table); array_pop ($ table); foreach ($ table as $ key => $ tr) {$ td = explode ('{td}', $ tr); array_pop ($ td); $ td_array [] = $ td;} return $ td_array;}?>
  
 

Examples in this article describes how php converts each column in an HTML table into an array to collect table data. Share with me...

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.