- var_dump: documentation ( source)
- preg_match_all: documentation ( source)
<?php
$re = '/<li[^>]*>(.*?)<\/li>/';
$str = '<li>one</li><li id=\'someId\'>two</li>';
preg_match_all($re, $str, $matches, PREG_SET_ORDER, 0);
// Print the entire match result
var_dump($matches);