explode two-item-list in array as key=>value

后端 未结 3 954
不知归路
不知归路 2021-02-06 05:12

I\'d like to explode a multi-line-string like this

color:red
material:metal

to an array like this

$array[\'color\']=red
$array[         


        
3条回答
  •  灰色年华
    2021-02-06 05:24

    explode first on line break. Prolly \n

    Then explode each of the resulting array's items on : and set a new array to that key/value.

提交回复
热议问题