I have this variable in php:
$log = "
- [ADD] Lorem Ipsum.
- [FIX] consetetur sadipscing elitr.
- [IMP] sed diam voluptua.";
I'm trying to create the following 2-D array like:
$logarray = array (
array (
"type" => "ADD",
"description" => "Lorem Ipsum."
),
array (
"type" => "FIX",
"description" => "consetetur sadipscing elitr."
),
array (
"type" => "IMP",
"description" => "sed diam voluptua."
)
);
I am thinking of using the function explode() but I do not know how in this case.
Any help is appreciated.
[]for thetype\[[^\]]+\]\s+[^\n]+