Created
October 18, 2016 07:14
-
-
Save saroarhossain57/0204eb4ae50b2e9b63635241efa899cc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$input = '<button name="submit">Delere</button>@copy;'; | |
echo htmlentities($input); | |
echo '<br>'; | |
?> | |
<?php | |
//encode a html code to string for all the charecter | |
$str = "A 'quote' is <b>bold</b>"; | |
// Outputs: A 'quote' is <b>bold</b> | |
echo htmlentities($str); | |
?> | |
<?php | |
//encode a html code to string for some spacial charecter | |
echo '<h1>htmlspecialchars function</h1><br><br>'; | |
$new = htmlspecialchars("<a href='test'>Test</a>", ENT_QUOTES); | |
echo $new; // <a href='test'>Test</a> | |
?> | |
<?php | |
//remove all html tags from a sting. | |
echo '<h1>strip_tags() function</h1><br><br>'; | |
echo strip_tags("<del>Hello</del> <b><i>world!</i></b>","<i><del>"); | |
?> | |
<?php | |
//filter all the sql injection in html form for inserting data. | |
//mysqli_real_escape_string($db_con, $sring); | |
?> | |
<?php | |
echo '<h1>filter_var() function</h1><br><br>'; | |
//filter php function | |
$email = '[email protected]'; | |
if (filter_var($email, FILTER_VALIDATE_EMAIL)) { | |
echo 'The email is valid!'; | |
} | |
else{ | |
echo 'The email you have entered is not valid'; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment