string addcslashes function - returns a string with backslashes before characters that are listed in charlist
string-addcslashes-function-in-php.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>string addcslashes function - returns a string with backslashes before characters that are listed in charlist</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Author" content="Md Iqbal Hosan">
<meta name="title" content="string addcslashes function - returns a string with backslashes before characters that are listed in charlist">
<meta name="keywords" content="php, example, code, array, function, addcslashes, string">
<meta name="description" content="string addcslashes function - returns a string with backslashes before characters that are listed in charlist">
<style>
h2, h4{background:#ddd; color:#000079;}
h2{ padding:3px; margin:3px; font-size:21px;}
h4{ padding:2px; margin:2px; font-size:17px;}
p{padding:2px; margin:2px; color:#0099fb;}
body{ background:#FFFFFb;}
</style>
</head>
<body>
<h2>string addcslashes function - returns a string with backslashes before characters that are listed in charlist</h2>
<pre>
<?php
/*
-------------------------------------
let us make a simple string for test
-------------------------------------
*/
$mySlasheLessString = "my seo SEO boss is SK Saiful Islam";
echo "<h4>Output of mySlasheLessString in the browser</h4>";
print "<p>$"."mySlasheLessString = {$mySlasheLessString}</p>";
print "<p>string length : ".strlen($mySlasheLessString)."</p>";
/*
-----------------------------------------------------------------------------------
now i want to add a slashes like in C programming befor all the characters s and S
by using addcslashes string function
-----------------------------------------------------------------------------------
*/
$mySlashedString = addcslashes($mySlasheLessString, "S..Ss..s");
echo "<h4>Output of mySlashedString by using string addcslashes function</h4>";
print "<p>$"."mySlashedString = {$mySlashedString}</p>";
print "<p>string length : ".strlen($mySlashedString)."</p>";
?>
</pre>
</body>
</html>

No comments:
Post a Comment
leave your comments here..