Remove first 4 and last 5 characters from a string

I am not sure how to accomplish this and need some help.

I am using a CMS that automatically puts tags around content to dummy proof it for the end user. In this situation I am outputting a UL but the UL must retain a class so I want the CMS to just output the code starting with <li> and ending with </li> while the page itself contains the <Ul class=“1234”> followed by the script output by the CMS. Currently the issue is that the CMS is automatically putting <ul>code</ul> making the page ultimately show <Ul class=“1234”><ul>code</ul></ul>.

What I want to accomplish is to remove the first 4 and the last five characters (<ul> and </ul>) from the string the CMS creates.

Its important to note that I can’t use php to simply remove all the ul tags because in some cases there are nested uls that are output by the CMS and the uls in the middle of the code are necessary.

Here is a sample of the script placed on the page to display the code from the CMS:

echo CMS_getCMSContent($database_CMSConnection, $CMSConnection, 'Sub Nav', Link List', false);

Any help would be greatly appreciated!

This function will do the trick:

PHP: substr - Manual

You could also do a find & replace (with an empty character), which would probably be more appropriate:

PHP: str_replace - Manual

string newstring = str_replace(array("<ul>", "</ul>"), oldstring, "");