strlen(): This function is used to get the length of string. <?php $str=”Welcome” echo strlen($str); ?> Output: 7
ucwords: This function is used to convert the first characters of all words in a string into uppercase . <?php $str=”welcome To Webnoid Schools”; echo ucwords($str); ?> Output: Welcome To Webnoid Schools
ucfirst: This function is used to convert the first character of a string to character. <?php $str=”welcome to webnoid schools”; echo ucfirst($str); ?> Output: Welcome to webnoid schools
nl2br: This function is used to break the new lines of a string. <?php echo nl2br(“Welcome \n to \n Webnoid schools”); ?>
ord: This function is used to get ASCII value if input control. <?php echo ord(‘a’); ?>
chr: This function is used to get the character of specified ASCII value. <?php echo chr(97); ?>
strtoupper: This function is used to convert all characters of a string into upper case. <?php $str=”webniod”; echo strtoupper($str); ?>
strtolower: This function is used to convert all character of string into lower case. <?php $str=”WEBNOID”; echo strtolower($str); ?>
str_word_count: This is used to get the total number of words in a string. <?php $str=”Welcome to Webnoid Schools”; echo str_word_count($str); ?>
str_repeat: This function is used to repeat a string with specific (interval) number of times. <?php $str=”Webnoid Schools”; echo str_repeat($str,5); ?>
str_replace: This function is used to replace a string with a new string. <?php $str=”Webnoid Schools”; echo str_replace(“Webnoid Schools”, “Webnoid Soft Solutions”, $str); ?>
similar_text: By this function we can get similarities between two strings. <?php $str1=”Webnoid”; $str2=”Webnoid”; echo similar_text($str1,$str2); ?>
trim: By using this we can remove the left hand side and right hand side spaces of a string. i) ltrim: To remove the left hand side space of a string. ii)rtrim: To remove the right hand side space of a string. <?php $str1=”Webnoid”; $str2=”Schools”; echo $str1.trim($str2); ?>
chop: It is same as rtrim i.e., it removes right hand side of a string.
strchr: This function is used to get a string from specified character of a string. <?php $str=”Webnoidschools”; echo strchr($str,”d”); ?>
strrchr: This function is used to get sub string from a string based on specific character it searches for the specific character from reverse direction of a string. <?php $str=”Webnoidschools”; echo strrchr($str,’d’); ?>
stristr: It is same as strchr but it is case insensitive. <?php $str=”Webnoidschools”; echo stristr($str,’D’); ?>
strstr: This is same as strchr but it searches based on specific string . <?php $str=”Webnoid Schools”; echo strstr($str, “Schools”); ?>
substr: To get sub string of a string. <?php $str=”Webnoidschools”; echo substr($str,2,4); ?>
strcmp: This function is used to compare two strings it is case sensitive. If both strings are same then it returns 0. If first string is is greater than second string it returns >0, if first string is less than than second then it returns <0. <?php $str1=”Webnoid”; $str2=”webnoid”; echo strcmp($str1,$str2); ?>
strcasecmp: This is same as strcmp but it is case insensitive.