How to explode this array value:
$row = array(
[0] = 1,1,Carlyle,Rogers,1,"Carlyle, Rogers",0000-00-00,,carlyle.rogers@stafford-trust.com,,non premium)
I tried this code
$values = explode(',', $row[0]);
and give me this wrong output:
Array (
[0] => 1
[1] => 1
[2] => Carlyle
[3] => Rogers
[4] => 1
[5] => "Carlyle
[6] => Rogers"
[7] => 0000-00-00
[8] =>
[9] => carlyle.rogers@stafford-trust.com
[10] =>
[11] => non premium
)
What I want is to Output must be like this one:
Array (
[0] => 1
[1] => 1
[2] => Carlyle
[3] => Rogers
[4] => 1
[5] => "Carlyle, Rogers"
[6] => 0000-00-00
[7] =>
[8] => carlyle.rogers@stafford-trust.com
[9] =>
[10] => non premium
)
You can't use explode
like that because your input seems to be CSV-formatted and explode
knows nothing about that "format". Use str_getcsv
instead:
$values = str_getcsv($row[0]);