Tool that returns htmlspecialchars() of any input

Occasionally it’s good to perform htmlspecialchars() over some input without testing it via local script in order to understand how the outcome will look like which is good especially for students and newbies. Feel free to test the tool below. If we want an output of htmlspecialchars() function to be shown proprerly in a textare element, then we have to call this function two times.

htmlspecialchars is a PHP function that converts special characters to HTML entities.

 

Code example

<?php //returns and does echo ot htmlspecialchars() in textarea $str[] = "<some HTML tag> could be shown <a>here</a>"; echo "<div><h2>The result is following</h2><textarea cols="100" rows="15" readonly>". htmlspecialchars(htmlspecialchars($str[0]))."</textarea> <p>Bear in mind it’s necessary to call <mark title="htmlspecialchars_decode()">htmlspecialchars_decode()</mark> function over the above-shown result to make HTML tags working!</b></div>"; ?>

Other tools & help

If you need help with PHP scripting, Apache setup and server-related situations, drop me a line. You’re also welcome to visit other tools - they’re listed below.