- print_r: documentation ( source)
- preg_match_all: documentation ( source)
<?php
$str = '<li data-type="mentionable" data-id="2">bla bla... <li
data-type="mentionable" data-id="812">some test <li>bla bla </li>more text <li
data-type="mentionable" data-id="282">';
preg_match_all("/data-id=\"(\d+)\"/", $str, $matches);
print_r($matches[1]);