PHP explode and assign it to a multi-dimensional array

前端 未结 6 1916
天命终不由人
天命终不由人 2021-01-19 17:11

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\"         


        
6条回答
  •  余生分开走
    2021-01-19 17:38

    If you like it quick and dirty:

    foreach($data = explode("\n",$data) as &$d) {
        $d = explode(' ',$d);
    }
    

提交回复
热议问题