How does php delete columns in a CSV file?

Source: Internet
Author: User
Tags null null
How does php delete columns in a CSV file? I have a csv file: aaanullnullNull1112223337744412355588 ------------------ how can I determine if [123] exists in a column, keep this column, and delete other columns? Please kindly advise! Thank you! ------ Solution ----------------- how does php delete columns in a CSV file?
I have a csv file:

Aaa null Null

111 222 333 77
444 123 555 88
------------------
How can I determine whether a column contains [123], retain this column, and delete other columns?

Please kindly advise! Thank you!




------ Solution --------------------
PHP code
[User:root Time:05:47:12 Path:/home/liangdong/php]$ php csv.php [User:root Time:05:47:14 Path:/home/liangdong/php]$ cat csv.out aaa null111 222444 123123 456[User:root Time:05:47:17 Path:/home/liangdong/php]$ cat csv.php 
   $value) {                if (isset($filter[$index])) {                        $out_row[] = $value;                }        }        if (!empty($out_row)) {                fputcsv($fout, $out_row, ' ', ' ');        }}fclose($fin);fclose($fout);?> 

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.