i'm going round in circles. I want to search a string for a span tag, then replace it with an alternate version then finally print a list of all the changes.
I hope this helps show someone what i'm trying to do... fancy the challenge?
// create array to hold tooltips
$tips = array();
// search $content string and add all matching strings to $tips array
$haystack = $content;
$needle = '<span class="has-tip">['.ADD THIS TO $tips ARRAY.']</span>';
// print $content and string replace as such...
$replace = '<span class="has-tip">['.$tips[$i].']</span>';
$with = '<a href="#_ftn'.$i.'" name="_ftnref'.$i.'"><span data-tooltip aria-haspopup="true" class="has-tip top" data-disable-hover="false" tabindex="'.$i.'" title="'.$tips[$i].'">['.$i.']</span></a>';
print $content;
// list all tooltips
echo '<ul>';
foreach ($tips as $key => $tip) {
echo '<li><a href="#_ftnref'.$key.'" name="_ftn'.$key.'">['.$key.']</a> '.$tip.'</li>';
}
echo '<ul>';