Revision: 53225
Updated Code
at December 31, 2011 01:33 by macodev
Updated Code
function trim_br($string){ $string = preg_replace('/^\s*(?:<br\s*\/?>\s*)*/i', '', $string); $string = preg_replace('/\s*(?:<br\s*\/?>\s*)*$/i', '', $string); return $string; } echo "**".trim_br('<br /> <br/>example text <br/> newline <br />')."**";
Revision: 53224
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at November 16, 2011 22:52 by macodev
Initial Code
function trim_br($string){ //elimina spazi vuoti e tag br a inizio e fine stringa $string = preg_replace('/^\s*(?:<br\s*\/?>\s*)*/i', '', $string); $string = preg_replace('/\s*(?:<br\s*\/?>\s*)*$/i', '', $string); return $string; } echo "**".trim_br('<br /> <br/>esempio testo <br/> a capo <br />')."**";
Initial URL
Initial Description
Deletes empty spaces and br tags on start and end of a string
Initial Title
Trim BR tags from string
Initial Tags
Initial Language
PHP