私はこのようなcsvファイルを持っています
Number,Name,UG College,UG University,PG College,PG University
1100225,Lakshmin,pkrrrr College,"PKRRRRR University, Choice",nandhaaaaa,"Nandhaa University, Kumali"
ファイルを読んでいる間、二重引用符内のみコンマを置き換えたいと思います。
前もって感謝します 。
$string = '1100225,Lakshmin,pkrrrr College,"PKRRRRR University, Choice",nandhaaaaa,"Nandhaa University, Kumali"';
$string = preg_replace_callback(
'|"[^"]+"|',
create_function(
// single quotes are essential here,
// or alternative escape all $ as \$
'$matches',
'return str_replace(\',\',\'*comma*\',$matches[0]);'
),$string );
$array = explode(',',$string);
$array = str_replace('*comma*',',',$array);
print_r($array);
exit;