<?php
echo "This is printed doc";
//printf("This is another print");
$user="Ram";
echo "This is $user<br/>";
echo 'This is $user<br/>';
$user='ram"s';
$user=addslashes($user);
echo "$user<br/>";
$user=stripslashes($user);
echo "$user<br/>";
//$query="select * from table where username =$user";
//echo $query;
$str = "A 'quote' is <b>bold</b>";
// Outputs: A 'quote' is <b>bold</b>
echo htmlentities($str, ENT_QUOTES);
$test= htmlspecialchars("<a href='test'>Test</a>", ENT_QUOTES);
echo $test;
echo md5("test");
echo nl2br("foo isn't\n bar");
$pass="ram1";
if($pass=="ram")
{
echo "Authorized";
}
echo "<br/>";
$text = '<p>Test paragraph.</p><!-- Comment --> <a href=\"#fragment\">Other text</a>';
echo strip_tags($text);
echo strlen("rupak");
echo "<br/>";
$text = '<p>Test paragraph.</p><!-- Comment --> <a href=\"#fragment\">Other text</a>';
echo str_replace("p","b",$text);
echo "<br/>";
$text1="Returns a string with backslashes in front of predefined charactersReturns a string with backslashes in front of predefined charactersReturns a string with backslashes in front of predefined charactersReturns a string with backslashes in front of predefined charactersReturns a string with backslashes in front of predefined charactersReturns a string with backslashes in front of predefined characters";
echo substr($text1,0,50);
echo "<br/>";
echo strtolower("TEXT");
echo "<br/>";
echo strtoupper("text");
echo "<br/>";
$result= strpos('abcde','g');
if($result!==FALSE)
{
echo "found";
}
else
{
echo "Not found";
}
echo "<br/>";
//
$email = 'name@example.com';
$domain = strstr($email, '@');
echo $domain; // prints @example.com
?>
Uses of stripslashes addslashes, example of stripslashes, example of addslashes, example of substr, example of strtoupper, example of strstr, example of strpos, example of strlen, example of str_replace, example of strip_tags, example of htmlspecials, example of md5
No comments:
Post a Comment