ryan_z Posted March 26, 2009 Share Posted March 26, 2009 Hello, on the PHP site I found some code to turn a CSV file into an array like so. 1,dog,cat,mouse 2,fish,shark,squid [0] => Array ( [0] => 1 [1] => dog [2] => cat [3] => mouse ) [1] => Array ( [0] => 2 [1] => fish [2] => shark [3] => squid ) Anyway, my csv file is about 500-5000 lines and each row has 33 columns. The function I was using had this code that was failing: $expr="/\n(?=(?:[^\"]*\"[^\"]*\")*(?![^\"]*\"))/"; $rows=preg_split($expr,trim($fileContent)); This worked fine if I had a file with 133 or less rows. Once I went over 133 rows the script immediately failed (no 30 second wait or anything). The script would not even print text outside of the php brackets. Just a blank page. I'm not too good with regular expressions, so I was having trouble working with it, thank you in advance. I'm using PHP 5.2.8 and Apache 2.2.11 on FreeBSD 6-4 Link to comment https://forums.phpfreaks.com/topic/151274-preg_split-dies-without-error/ Share on other sites More sharing options...
ober Posted March 26, 2009 Share Posted March 26, 2009 I would guess that you have a problem in your CSV file at line 134. Link to comment https://forums.phpfreaks.com/topic/151274-preg_split-dies-without-error/#findComment-794640 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.