Created
September 29, 2016 07:24
-
-
Save gongdo/220bd5663154613cc02352505f0c0e22 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function replaceInterXmlWhiteSpace($xml) { | |
return preg_replace('/>\s*<\//', '></', $xml); | |
} | |
// 이메일의 예제 | |
$replaced = replaceInterXmlWhiteSpace('</span></p><p><span style="font-size:13.3333px;"> </span></p><p><span style="font-size:13.3333px;">'); | |
echo htmlspecialchars($replaced); | |
echo '<br />'; | |
// 공백이 여러개 있거나 탭이어도 제거함 | |
$replaced = replaceInterXmlWhiteSpace('<p> </p><span> </span><p> </p>'); | |
echo htmlspecialchars($replaced); | |
echo '<br />'; | |
// 개행 문자도 처리함 | |
$text = '<p> | |
</p>'; | |
$replaced = replaceInterXmlWhiteSpace($text); | |
echo htmlspecialchars($replaced); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment