www.xbdev.net
xbdev - software development
Sunday May 12, 2024
home | contact | Support | PHP... a powerful, flexible, fully supported, battle tested server side language ..

     
 

PHP...

a powerful, flexible, fully supported, battle tested server side language ..

 


HTML Tags (Finding, Removing, Encoding, ...)


PHP is a web language - and you're generating, reading, manipulating HTML... it's what the language was originally built for!


htmlentities - see the tags not the result


The builtin PHP function
htmlentities( ... )
lets you encode your HTML so it displays the `tags` not the actual output for the tags.

For example, this string:

$s "<h1>Hello World</h1>";

echo( 
$s );

$b htmlentities$s );

echo( 
$b );


What we want, is special HTML identifiers, like less than and greater than getting replaced with the HTML opcode (
<
and
>
).

The output (showing the raw html passed to the browser):

<h1>Hello World</h1>

&
lt;h1&gt;Hello World&lt;/h1&gt;

 
Advert (Support Website)

 
 Visitor:
Copyright (c) 2002-2024 xbdev.net - All rights reserved.
Designated articles, tutorials and software are the property of their respective owners.