i have data return as below:
2015-07-2111
ali,21,malaysia
alan,23,england
my expected array:
0=>2015-07-2111
1=>ali,21,malaysia
2=>alan,23,england
my code :
$info = explode(",",$string);
But the code do not produce the array that i want.
You're splitting it by , when you should be splitting it line by line, so change
$info = explode(",", $string);
//where $info becomes an array of "ali", "21", "malaysia\nalan", "23", "england"
to
$info = explode(PHP_EOL, $string);
//where $info becomes an array of "ali,21,malaysia", "alan,23,england"
as PHP_EOL is the "correct 'End Of Line' symbol for this platform"
$info = explode(",",$string);->$info = explode(PHP_EOL,$string);