dlebowski Posted September 16, 2007 Share Posted September 16, 2007 list($col1, $col2, $col3, $col4, $col5, $col6, $col7, $col8, $col9, $col10, $col11, $col12, $col13) = split( ",", $line, 13 ); I need assistance. I use the above line of code to split up a .csv file into columns. The problem I am running into is that if the column has a comma in it, it wants to create a new column. For example, if I have "This is a column, blah" it will break it out into two columns. One has "This is a column" and the other has "blah". Does anyone know how to get around this? Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/69543-split-function-assistance-needed/ Share on other sites More sharing options...
rarebit Posted September 16, 2007 Share Posted September 16, 2007 So the columns are in quotes as well as delimited by commas? Quote Link to comment https://forums.phpfreaks.com/topic/69543-split-function-assistance-needed/#findComment-349470 Share on other sites More sharing options...
rarebit Posted September 16, 2007 Share Posted September 16, 2007 If so look for some kind of lexical analyser, http://uk3.php.net/results.php?q=lex&l=en&p=wholesite, it look's like there's one in PEAR... Quote Link to comment https://forums.phpfreaks.com/topic/69543-split-function-assistance-needed/#findComment-349471 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.