1
I have a term insertion system via CSV files, example:
09999999;José
08888888;Maria
I get this file to move to the server and then I open this file to insert into the database. My problem is that I need to validate the insertion, I cannot insert repeat phones in the same file and for that I use this code for this:
$valida1 = array_search($numero1, $validaNumeroLista);
if (empty($valida1) )
{
array_push($validaNumeroLista, $numero1);
}
After that I make an insertion in the bank, the problem is that the insertion time has increased a lot.
For example:
Before entering this validation, a file with up to 20,000 lines would take about 5 to 7 seconds. Now with 1,000 lines it takes more than 2 minutes. Above 2,000 lines it is impossible to insert.
Have any tips on how to improve this performance?
Thanks Isac, for the performance information and the resolution, in my case worked with the option: if (!array_key_exists($numero1, $validaNumeRista)){ $validaNumerList[$numero1] = true; }
– Diego Braga