PHP Find String in CSV file

后端 未结 6 1159
无人及你
无人及你 2020-12-17 17:36

I\'ve got a large flat file of usernames and emails in the following format:

\"username\", \"email\"
\"username\", \"email\"
\"username\", \"email\"
<         


        
6条回答
  •  遥遥无期
    2020-12-17 17:43

    While fgetcsv is potentially a more elegant solution, that doesn't answer your original question: your second array element has a newline, and you're comparing against a string that doesn't.

    To fix:

    if ($string == str_replace('"','', chop($thisarray[1]))) {
    

提交回复
热议问题