PHP code example of gavinggordon / htmlentities

1. Go to this page and download the library: Download gavinggordon/htmlentities library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

gavinggordon / htmlentities example snippets


	
    $htmlentities = new \GGG\HtmlEntities();

    $to_encode = 'Test-,;:';
    // Set a variable containing a string of the encoded characters you wish to be encoded;
    
    $encoded = $htmlentities->encode( $to_encode );
    // Get the encoded result by using the encode method on the returned instance of HtmlEntities;
    
    echo $encoded;
    // Display the encoded result, which is of type String;
    // Test&amp;hyphen;&amp;comma;&amp;semi;&amp;colon;

    $to_decode = 'Test&amp;tilde;&amp;ast;&amp;lpar;&amp;num;';
    // Set a variable containing a string of the encoded characters you wish to be decoded;
    
    $decoded = $htmlentities->decode( $to_decode );
    // Get the decoded result by using the decode method on the returned instance of HtmlEntities;
    
    echo $decoded;
    // Display the decoded result, which is of type String;
    // Test~*(#