====== Split string using RegEx ====== $cols=preg_split('/(?<="),(?=")/', trim($row)); // Loop through items foreach ($cols as $col) { echo $col; } make sure to add / to the beginning and the end of your RegEx expression