Skip to content

Instantly share code, notes, and snippets.

@slav123
Created October 3, 2013 04:52
Show Gist options
  • Save slav123/6805169 to your computer and use it in GitHub Desktop.
Save slav123/6805169 to your computer and use it in GitHub Desktop.
produce xml safe stuff, same as ENT_XML1 but works with php 5.3
<?php
function xmlsafe($string) {
$replace = array(
'"'=> "&quot;",
"&" => "&amp;",
"'"=> "&apos;",
"<" => "&lt;",
">"=> "&gt;"
);
return strtr($string, $replace);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment