• Categories
    • PHP
    • phpMyAdmin
    • PHPMailer
    • FFMpeg
    • PHPEXcel
    • PHPDoc
    • PHPUnit
    • CakePHP
    • CakePHP 2.0
    • Cake PHP 2.1
    • CakePHP Model
    • Facebook PHP SDK
    • composer-php
    • PHP 7
    • PHP GD
    All Categories
  • About

PHP: convert all UTF-8 characters to HTML entities

phputf-8


PHP Snippet 1:

echo encodespecial('? ? Hello World ? ? ? this is a test....');
function encodespecial($str) {
    $convmap = array(0x80, 0xfffffff, 0, 0xfffffff);
    return mb_encode_numericentity($str, $convmap, 'UTF-8');
}

Related Snippets

Insert database rows from columns of data from associative array of indexed arrays

Do I need to install `fxp/composer-asset-plugin` if I'm not doing front-end development

Add rows to Single product Additional information table in WooCommerce 3.6

Testing subscription renewals on Stripe

Symfony - "framework.test" config is not set to true

xdebug 3 not working in ubuntu 20.04 with docker

Laravel Unresolvable dependency resolving [Parameter #0 [ <required> $method ]] in class GuzzleHttpPsr7Request

Access relation of pivot table in Laravel

WordPress ACFNotice: get_field() - We've detected one or more calls to retrieve ACF field values before ACF has been initialized

Implode array with array of glue strings

Why does using salted hash on python and php give me different results?

Get latest Tweets - What API

echo language construct is discouraged. (PHP)

How do I call Validator from a namespace with an already existing Validator class

Refresh specific HTML content that retrieves data from MySQL

About Contact Privacy policy Terms and conditions