I get a string in PHP and I need to look up the values of the IDs, can be 1, how can be 100 IDs, how to do? I tried something like this:
$text = 'Name1 <span id="indicado-b">John</span> Name2 <span id="indicado-c">Mike</span>';
preg_match_all('/<span id="indicado-(.*)"/si',$text, $match);
print_r($match);
The value that I need to receive is b
and c
, which are the ID values, but it is not returning this, I get:
Array ( [0] => Array ( [0] => John Name2 Array ( [0] => b">John Name2