priyank199 Posted October 19, 2021 Share Posted October 19, 2021 I have two csv files I want to compare it and create new one with matching data, I have write code but it's takes 5 hours how to reduce it file one size: 33 mb file two size: 25 mb Quote Link to comment https://forums.phpfreaks.com/topic/314042-compare-csv-files-data-and-create-new-one-in-php/ Share on other sites More sharing options...
Barand Posted October 19, 2021 Share Posted October 19, 2021 What have you tried? Quote Link to comment https://forums.phpfreaks.com/topic/314042-compare-csv-files-data-and-create-new-one-in-php/#findComment-1591211 Share on other sites More sharing options...
priyank199 Posted October 19, 2021 Author Share Posted October 19, 2021 (edited) 2 hours ago, Barand said: What have you tried? Suppose I have two files with large numbers of data, so I want to compare phone numbers, and create new file with matching data, here you can see two array data with same number "274177777", so how to compare with large data, as faster as posible in php code 1)csv1 data $array1= Array ( [0] => 274177777 [1] => 789787999 [2] => sp [3] => [4] => 8240 [5] => Ris [6] => Ja [7] => Te ) 2csv2 data $array2= Array ( [0] => 274177777 [1] => [2] => sp [3] => [4] => 8240 [5] => Ris ) Edited October 19, 2021 by priyank199 Quote Link to comment https://forums.phpfreaks.com/topic/314042-compare-csv-files-data-and-create-new-one-in-php/#findComment-1591214 Share on other sites More sharing options...
Barand Posted October 19, 2021 Share Posted October 19, 2021 I have no idea what I am looking in that example. Abstract examples seldom work. Am I looking at one record from each csv, or eight records from the first csv and six from the second Perhaps you could post the first 10 records from each csv so I can see what the data looks like. Quote Link to comment https://forums.phpfreaks.com/topic/314042-compare-csv-files-data-and-create-new-one-in-php/#findComment-1591215 Share on other sites More sharing options...
ginerjm Posted October 19, 2021 Share Posted October 19, 2021 Are your files 'code' or just raw data? You are showing arrays in your samples, but raw csv files do not have arrays in them. Quote Link to comment https://forums.phpfreaks.com/topic/314042-compare-csv-files-data-and-create-new-one-in-php/#findComment-1591216 Share on other sites More sharing options...
ginerjm Posted October 19, 2021 Share Posted October 19, 2021 PS to my previous - hard to call a file a 'CSV' file if there are no commas in it... Quote Link to comment https://forums.phpfreaks.com/topic/314042-compare-csv-files-data-and-create-new-one-in-php/#findComment-1591224 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.