Found 35163 Articles for Programming

strcoll() function in PHP

Chandu yadav
Updated on 30-Jul-2019 22:30:23

147 Views

The strcoll() function is used to compare two strings based on locale. Note − This function is case-sensitive Syntax strcoll(str1, str2) Parameters str1 − First string to compare str2 − Second string to compare Return The strcoll() function returns − 0 − if the two strings are equal < 0 − if string1 is less than string2 > 0 − if string1 is greater than string2 Example The following is an example − Live Demo Output 0 Example The following is an example − Live Demo Output de_CH: 32

strcmp() function in PHP

karthikeya Boyini
Updated on 26-Dec-2019 08:24:00

323 Views

The strcmp() function is used to compare two strings.Note − This function is case-sensitive.Syntaxstrcmp(str1, str2)Parametersstr1 − First string to comparestr2 − Second string to compareReturnThe strcmp() function returns −0 - if the two strings are equal0 - if string1 is greater than string2ExampleThe following is an example − Live DemoOutputThe following is the output −32ExampleLet us see another example − Live DemoOutputThe following is the output −-7424

strchr() function in PHP

Ankith Reddy
Updated on 30-Jul-2019 22:30:23

119 Views

The strchr() function is used to search for the first occurrence of a string inside another. Note − This function is case-sensitive. Syntax strchr(str, search, before_search) Parameters str − The string to search search − The string to search for before_search − If TRUE, the function returns the part of the str before the first occurrence of the $search Return The strchr() function returns the rest of the string from the matching point. FALSE, if the string to search for is not found. Example The following is an example − Live Demo ... Read More

strcasecmp() function in PHP

Samual Sam
Updated on 26-Dec-2019 08:22:36

131 Views

The strcasecmp() function is used to compare two strings.Note − The strcasecmp() function is case-insensitiveSyntaxstrcasecmp(str1, str2)Parametersstr1 − First stringstr2 − Second stringReturnThe strcasecmp() function returns −0 - if the two strings are equal0 - if string1 is greater than string2ExampleThe following is an example − Live DemoOutputThe following is the output −0ExampleLet us see another example − Live DemoOutputThe following is the output −$va11 is equal to $val2

str_word_count() function in PHP

Arjun Thakur
Updated on 24-Jun-2020 13:44:22

84 Views

The str_word_count() function returns information about words used in a string.Syntaxstr_word_count(str, return, char)Parametersstr − The string to checkreturn − The return value of the str_word_count() function.The following are the possible values −0  − It returns the number of words found1  − It returns an array with the words from the string2  − It returns an array where the key is the position of the word in the string, and value is the actual word.char − The special characters to be considered as word.ReturnThe str_word_count() function returns an array or number. It depends on the return parameter.ExampleThe following is an example ... Read More

str_split() function in PHP

karthikeya Boyini
Updated on 26-Dec-2019 08:20:24

117 Views

The str_split() function is used to convert a string to an array.Syntaxstr_split(str, len)Parametersstr − The string to splitlen − The length of each array element. The default is 1.ReturnThe str_split() function returns FALSE, if the length is less than 1. If len is larger than the length of string, the entire string will be returned as the only element of the array.ExampleThe following is an example − Live DemoOutputThe following is the output −Array (    [0] => A    [1] => n    [2] => d    [3] => r    [4] => o    [5] => i    [6] ... Read More

str_shuffle() function in PHP

George John
Updated on 30-Jul-2019 22:30:23

91 Views

The str_shuffle() function is used to randomly shuffle a string. Syntax str_shuffle(str) Parameters str − The string to shuffle Return The str_shuffle() function returns the shuffled string. Example The following is an example − Live Demo Output clemWeo Example The following is an example − Live Demo Output eomd

str_rot13() function in PHP

Samual Sam
Updated on 26-Dec-2019 08:18:42

65 Views

The str_rot13() function is used to perform the rot13 transform on a string.Syntaxstr_rot13(str)Parametersstr − The string to encodeReturnThe str_rot13() function returns the ROT13 version of the encoded string.ExampleThe following is an example − Live DemoOutputThe following is the output −Qrzb grkg

str_replace() function in PHP

Chandu yadav
Updated on 24-Jun-2020 13:45:13

272 Views

The str_replace() function is used to replace a string with another string.Note  − The function is case-sensitive.Syntaxstr_replace(find, replace, str, count)Parametersfind − The value to searchreplace − The string with which we want to replace the $findstr − The string to be searchedcount − The number of replacementsReturnThe str_replace() function returns a string or an array with the replaced values.ExampleThe following is an example − Live DemoOutputI am DavidExampleThe following is an example − Live DemoOutputArray (    [0] => one    [1] => two    [2] => four ) Number of Replacements = 1

str_repeat() function in PHP

karthikeya Boyini
Updated on 26-Dec-2019 08:24:57

125 Views

The str_repeat() function is used to repeat a string.Syntaxstr_repeat(str_to_repeat, multiplier)Parametersstr_to_repeat − The string to repeat.multiplier − The number of times the string will be repeated. It must be greater than or equal to 0.ReturnThe str_repeat() function returns the repeated string.ExampleThe following is an example − Live DemoOutputThe following is the output −$$$$$$$$$$

Advertisements