Header menu


Tuesday, 29 October 2013

Concatenate html tags to string in php

To add html tags to string in php ... You have to concatenate html tags with string using htmlentities()
as shown below
Here i have added <u> tag to my string test which is passed to htmlentities() function for concatenation.

For more details see the example

$mystring="Hello ... This is my test string . I am testing it for htmlentities()";
echo "This is string before adding html tags"."</br>";
echo "</br>";
echo $mystring;
echo "</br>";
echo "</br>";
echo "This is string after add html tags"."</br>";
echo "</br>";
echo $finalstring;