nggit/php-xmlentities

Convert all Unicode characters and character references to numeric character references

dev-master 2019-03-05 04:48 UTC

This package is auto-updated.

Last update: 2024-05-05 18:33:21 UTC


README

Tip: Rename this md file to php to test it on your web server.

<?php

require 'src/NCR.php';

$str     = '<p> &copy; © with ❤ </p>';
$encoded = Nggit\PHPXMLEntities\NCR::encode($str);

These are portable ASCII characters

echo $encoded;
// Source view:
// <p> &#169; &#169; with &#10084; </p>
exit;

?>

That's it! This library doesn't use the mbstring or iconv extension for better compatibility.