User Tools

Site Tools


development:php:regex

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

development/php/regex.txt · Last modified: 2017/08/10 10:59 (external edit)