Sample code for 30+ languages & platforms
PHP Requires Chilkat v11.1.0+

HTML Encoding

Demonstrates HTML encoding and decoding.

Chilkat PHP Downloads

Chilkat2 PHP
<?php

use Chilkat2\Crypt2;

$crypt = new Crypt2();

$s = '< é ü ç Ω Hello & World ✓ >';

$htmlEncoded = $crypt->EncodeString($s, 'utf-8', 'html');
echo $htmlEncoded, "\n";

// Output:
// < &eacute; &uuml; &ccedil; &ohm; Hello & World &check; >

// To decode:
$s = $crypt->DecodeString($htmlEncoded, 'utf-8', 'html');
echo $s, "\n";

// Output:
// < é ü ç Ω Hello & World ✓ >