HI there, I am using a trim_text function in combo with some simple str_replace to make sure the code ends with </ul> But i like to remove the last <li>whatever</li> Code (markup): $res = preg_replace('<li>????</li>','',$content); Code (markup): regards,
why don't you use strrpos to get last position of li...using regex it would be difficult to get LAST li use this: $pos = strrpos($content, "<li>"); This will give you position of last li $res = substr($content, 0 , $pos+1); Hope this helps...
hi abstractworld, You are right i am puzzled but your suggestion seems to work almost as i want it. i had to $pos-1 and add </ul>