I have a string in this form :
<strong>dsds </strong><em>sdqsd </em><span style='text-decoration: underline;'>test</span>
and i want to put it in an associative array :
array('strong' => 'dsds' , 'em' => 'sdqsd' , 'underline' => 'test');
in a way that the order of elements int this array have to be the same as their order in the string .
which means if i have for example :
<span style='text-decoration: underline;'>test</span><strong>dsds </strong><em>sdqsd </em>
i get :
array( 'underline' => 'test', 'strong' => 'dsds' , 'em' => 'sdqsd');
I tried doing it by using strpos in a loop but that's a lot of iterations specialy if i have a big string, so is there a simpler way using regex ?
Thanks.