PHP code example of initphp / escaper

1. Go to this page and download the library: Download initphp/escaper 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/ */

    

initphp / escaper example snippets

 
composer 
 
public static function esc(string[]|string $data, string $context = 'html', ?string $encoding = null): array|string;
 

nitPHP\Escaper\Esc;

$input = '<script>alert("initphp")</script>';


InitPHP\Escaper\Esc;

$input = 'faketitle onmouseover=alert(/InitPHP!/);';


nitPHP\Escaper\Esc;

$input = 'bar&quot;; alert(&quot;Hello!&quot;); var xss=&quot;true';


InitPHP\Escaper\Esc;

$input = <<<INPUT
body {
    background-image: url('http://example.com/bar.jpg?</style><script>alert(13)</script>');
}
INPUT;


InitPHP\Escaper\Esc;

$query = <<<QUERY
" onmouseover="alert('hello')
QUERY;