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);?>