Ive been trying to use preg_split
but it's not working very well, this is how I'm using it:
$html_str = '<span class="spanClass" rel="rel span">Text Span</span>';
$arrTemp = preg_split('/\<span class=\"spanClass\" rel=\"(.+?)\"\>(.+?)\<\/span\>/', $html_str);
So I would get this 2 '(.+?)'
variables into an array(span rel and Text Span)
.
I'm probably not thinking about it in the best possible way to solve my problem, but the fact is that my string will have more than one <span>
mixed with trash html and I need to separate only the <span>
content in an array. Any better ideas?