function regex_list($matches = array()) { if (count($matches) == 3) { $type = $matches[1]; $txt = $matches[2]; } else { $txt = $matches[1]; } if ($txt == "") { return; } if ($type == "") { $txt = regex_list_item($txt); return "<ul>{$txt}</ul>"; } else { $txt = regex_list_item($txt); return "<ol type='{$type}'>{$txt}</ol>"; } }
function regex_list($text = "", $type = "") { if ($text == "") { return; } if ($type == "") { return "<ul>" . regex_list_item($text) . "</ul>"; } else { return "<ol type='{$type}'>" . regex_list_item($text) . "</ol>"; } }