I
I
Ivan2022-03-14 20:31:16
PHP
Ivan, 2022-03-14 20:31:16

How to search and display all found values ​​from PHP csv file?

There is a csv file seen
"03/12/2022 ; value1 ; value 2"
"03/14/2022 ; value1 ; value 2"
"03/14/2022 ; value1 ; value 2"
"03/13/2022 ; value1 ; value 2
" output lines, for example, where 03/14/2022. each on a new line?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
rPman, 2022-03-14
@rPman

filtering by value is best done using third-party tools optimized to the maximum,
for example, grep will filter by the contents of the line, you can use it regularly
, and from php you can work with help - fopen, the !feof loop and fgetcsv
ps fgetcsv is much slower than simply reading fgets lines, but it can read strings with escaped quotes '"', so if there are none then work with the text directly

T
ThunderCat, 2022-03-14
@ThunderCat

file() + foreach() + strpos() seems to be the fastest option...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question