i have string data like these:
$productList="
Saluran Dua(Bothway)-(TAN007);
Speedy Password-(INET PASS);
Memo-(T-Memo);
7-pib r-10/10-(AM);
FBI (R/N/M)-(Rr);
";
how can i split them, so the result is:
Array1(
[0]=>Saluran Dua(Bothway)
[1]=>Speedy Password
[2]=>Memo
[3]=>7-pib r-10/10
[4]=>FBI (R/N/M)
);
Array2(
[0]=>TAN007
[1]=>INET PASS
[2]=>T-Memo
[3]=>AM
[4]=>Rr
);
i tried preg_match_all
, this is for array1:
$separator = '/\-\(([A-z ]*)\)/';
preg_match_all($separator, $productList, $match);
$value=$match[1];
and this is for array2:
$separator2 = '/\;([A-z ]*)\-/';
preg_match_all($separator2, $productList, $desc);
$desc=$desc[1];
the result is showed, some of them right and some else disappear.. i believe there's wrong in preg_match_all. i hope you can give me solution..