How to Parse HTML tags using PHP, How to do, Top 1o Lists, Hacking, Games, Pictures, Tips and Tricks, PHP, Movies.

How to Parse HTML tags using PHP

PHP has the built-in function strip_tags() for this purpose.  strip_tags() function strips a string from HTML, XML, and PHP tags.

Syntax:

strip_tags(string,allow)

Parameters:

String – required and used for checking the string

allow – optional and used for specified allowed tags in string.

Example:

<?php
echo strip_tags(“<i>Hello </i> <b>world!</b>”,”<b>”);
?>

Output of this statement is ” Hello world! ” , Hello is not formatted italic because we only allow the <b> tag.

Related posts:

Tags: , ,
© 2012 Ataaso. All rights reserved.
Read » How to Parse HTML tags using PHP Article, Top Ten List, Wordpress Hack, Programming Tricks, Amazing Pictures