I have a string in PHP:
$haystack = "[:something 1]Here is something 1 content[:something 2]here is something else[:something completely different]Here is the completely different content"
And it can continue forever.
So, I need to split them into an associative array:
$final_array = [
'something 1' => 'Here is something 1 content',
'something 2' => 'here is something else',
'something completely different' => 'Here is the completely different content'
]
The only thing that is set is the beginning [:
and then the end ]
The keyword can be a whole sentence with spaces etc.
How to do this?