Convert each row and column of an HTML table into an array to collect table data.

Source: Internet
Author: User
Convert each row and column of an HTML table into an array to collect table data.
  • $ Table = str_replace (""," {Td} ", $ table );
  • // Remove the HTML tag
  • $ Table = preg_replace ("'<[/!] *? [^ <>] *?> 'Si "," ", $ table); // OSPHP. COM. Cn open source
  • // Remove the white space characters
  • $ Table = preg_replace ("'([rn]) [s] +'", "", $ table );
  • $ Table = str_replace ("", "", $ table );
  • // Open source code OSPHP. COM. Cn
  • $ Table = str_replace ("", "", $ table );
  • $ Table = explode ('{tr}', $ table );
  • Array_pop ($ table); // PHP open source code
  • Foreach ($ table as $ key => $ tr ){
  • $ Td = explode ('{td}', $ tr );
  • Array_pop ($ td );
  • $ Td_array [] = $ td; // PHP open source code
  • }
  • Return $ td_array;
  • }
  • ?>

  • "," {Tr} ", $ table); // open-source OSPhP. COm. CN
    Convert each row and column of an HTML table into an array to collect table data.

    1. // Convert each row and column of an HTML table into an array to collect table data
    2. Function get_td_array ($ table ){
    3. $ Table = preg_replace ("' ] *?> 'Si "," ", $ table );
    4. // OSPHP. COm. CN
    5. $ Table = preg_replace ("' ] *?> 'Si "," ", $ table );
    6. $ Table = preg_replace ("' ] *?> 'Si "," ", $ table );
    7. $ Table = str_replace ("

    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.