here i have a built in php function that in this example i am using to turn the content inside a span tag into an array.
preg_match_all('/<span.*?</span>/', $var, $newVar);
is it possible to kind of place into an array the other text between the span tags.
<p>i am a sentence <span id="blah"> im content inside of the span </span> im another sentence <span id="anId">i m another span content</span> im the last sentence in this p tag <span id="last">im the third span tag in this p tag<span></p>
more specifically
the above function will output the above p tag as an array of span tags with just the text inside and no tags around it wich is good step one accomplished it would look something like this
array ([0] => im content inside of the span [1] => i m another span content [2] => im the third span tag in this p tag )
this is the text inside the span tags, i want to use these to implode the string.
, now i want to do the opposite and have the strings in between them as an array.
i want to get an output of
array ([0] => i am a sentence [1] => im another sentence [2] => im the last sentence in this p tag )
this is the text outside of the span tags
Surely this is possible?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…