PHP explode and assign it to a multi-dimensional array
问题 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"; $data = explode("\n", $data); so a print_r($data); will output: Array ( [0] => i love funny movies [1] => i love stackoverflow com [2] => i like rock song ) now if i do like this: $line_data = explode(" ", $data); // explode $data variable by spaces. a print_r($line_data); will give me this: Array ( [0] => i [1] => love [2] => funny [3] =>