PHP Check if array index is set and not out of bound -


I'm reading from a CSV file containing thousands of rows

Now some lines are formatted correctly And therefore, when I try to read a particular index in a loop, I get superior offset errors. I

I just want to remove those lines and for that purpose me It must be done to find out which lines cause problems Only

What is happening inside the loop:

  $ i = 0; $ {+ Line_of_text = fgetcsv ($ file_handle, 2048, ","); $ IDX = $ line_of_text [5]; $ I ++;   

The code works perfectly but I get 10-15 errors Undefined Offset: 5 in the file path It is really difficult to define those lines now, by looking at the file, is there a way to check it out? Is that line included index 5 elements and if not, show the line number? I tried isset but it is not working

ah

  "I tried isset but this work Do not work " 

issue should work: try

  if (isset ($ line_of_text [5] ])} {$ Idx = $ line_of_text [5];} and {print "wrong row: $ i \ n";}  

Comments