This function remove backslashes from the string.
Return Type :- string
<?php
echo stripcslashes("I a\m U\ser");
?>
Output:-
I am User
This function remove backslashes from the string.
Return Type :- string
<?php
echo stripcslashes("I a\m U\ser");
?>
Output:-
I am User
md5(Message-Digest algorithm 5) return 32-digit hexadecimal number for every string. This function use RSA Data Security.
Return Type :- string
<?php
$str="pass1234";
echo md5($str);
?>
Output :-
b4af804009cb036a4ccdc33431ef9ac9
Note : This function is use for security purpose. Just like password field. User can store password generated by md5() function value.
This function convert first character of the string(sentences) into uppercase.
Return Type :- string
Example 3:-
<?php
echo ucfirst("php tutorial");
?>
Output :-
Php tutorial
This function convert first character of the string(single word) into uppercase.
Return Type :- string
Example 4:-
<?php
echo ucwords("php tutorial");
?>
Output :-
Php Tutorial
This function convert string into array of the strings. And the string is split by the delimeter. here delimeter is space.
Return Type :- array
Example 5:-
<?php
$str = "This is test script";
$array_str=explode(" ",$str);
for($i=0;$i<count($array_str);$i++)
{
echo $array_str[$i]."<br>";
}
?>
Output :-
This
is
test
script
This function convert array into string.
Return Type :- string
Example 6:-
<?php
$array_str = array("This","is","test","script");
$str=implode(" ",$array_str);
echo $str;
?>
Output :-
This is test script
This function returns the portion of the string from the string. and user specified the start location and number characters
Return Type :- string
Example 7:-
<?php
echo substr('shishir',3,2);
?>
Output :-
sh
This function is use to print special characters like
less than(<),greater than equal to (>=)
Note :- We can also print HTML Tag like
<b>test</b>
<img src="my.gif" /> etc.
Return Type :- string
Example 8:-
<?php
echo htmlspecialchars("<a href='#'>Click Here</a>");
?>
Output :-
<a href='#'>Click Here</a>
This function is use for format the number with grouped thousands By this number look like english notation , French notation etc.
look this function carefully
number_format(number,decimals,decimalpoint,separator)
Return Type :- string
Example 9:-
<?php
$number = 1239464.5647;
echo number_format($number);
echo "<br>";
echo number_format($number,2);
echo "<br>";
echo number_format($number, 2, '.', ' ');
echo "<br>";
echo number_format($number, 2, '.', '');
?>
Output :-
1,239,465
1,239,464.56
1 239 464.56
1239464.56
This function compare two string. if both string match then strcmp function return 0
otherwise returns any interger value. Note:- comparison is case sensitive.
Return Type :- int
Example :-
<?php
$str1="shishir";
$str2="shishir";
echo strcmp($str1,$str2);
?>
Output :-
0
addcslashes() :- add backslashes in front of the string (character is specified by user).
Return type (string)
addslashes() :- add backslashes in front of the string (character is specified by predefined).
Return type (string)
chr() :- return the ASCII value of character.
Return type (string)
chunk_split() :- Split a string into series of smaller parts.
Return type (string)
ltrim() :- Remove space from left side of the string.
Return type (string)
rtrim() :- Remove space from right side of the string.
Return type (string)
trim() :- Remove space from left and right both side
Return type (string)
stripslashes() :- Remove backslashes that is add by addslashes.
Return type (string)
strrev() :- This function reverse the string.
Return type (string)
strlen() :- This function find length of the string. length means total number of character.
Return type (int)