Last active
November 25, 2016 10:05
-
-
Save igancev/673a1a5ba35f06b3c5c9b8c9ff52a501 to your computer and use it in GitHub Desktop.
Подготовка текста перед вставкой его в xml (text2xml)
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 | |
class XmlHelper | |
{ | |
public static function text2xml($text) | |
{ | |
$text = preg_replace("/[\x1-\x8\xB-\xC\xE-\x1F]/", "", $text); | |
$text = str_replace('"', '"', $text); | |
$text = str_replace("&", "&", $text); | |
$text = str_replace(">", ">", $text); | |
$text = str_replace("<", "<", $text); | |
$text = str_replace("'", "'", $text); | |
return $text; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment