Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

How to split a csv file in PHP?

Avatar of kenjaW
kenjaW asked on
2 Comments1 Solution1834 ViewsLast Modified:
I've got a large csv file that I'm creating using php.  At the end of the script, I have a single variable that contains the entire csv file contents (less the header which I have in a separate variable).  I want to run the csv file variable through a splitter that will break down the file into chunks of N lines.  I upload the files and am file size limited.  Obviously, I'd need to split the file after a /r/n so it breaks at the end of a line.  

I'd ultimately like a function that looks something like this:

$csv_array=split_csv($num_lines, $input_csv_file, $csv_header);

but if someone can get me on the right track, I'm happy to code it up and share it.  

Avatar of hernst42
This problem has been solved!
Unlock 1 Answer and 2 Comments.
See Answers