i want to explode a string two time and make a multi-dimensional array.
$data = \"i love funny movies \\n i love stackoverflow dot com \\n i like rock song\"
You can use this solution without using explode:
$data = "i love funny movies \n i love stackoverflow dot com \n i like rock song";
$line_data = explode(" ", $data);
$arrayLines = [];
for($i = 0, $j = 0; $i < count($line_data); $i++) {
if($line_data[$i] != "\n") {
$arrayLines[$j][$i] = $line_data[$i];
} else {
$arrayLines[$j][$i] = $line_data[$i];
$j++;
}
}
print_r($arrayLines);