Found 35164 Articles for Programming

strncmp() function in PHP

karthikeya Boyini
Updated on 26-Dec-2019 09:05:50

153 Views

The strncmp() function is used to compare first n character.Note − The function is case-sensitive.Syntaxstrncmp(str1, str2, len)Parametersstr1 − The first stringstr2 − The second stringlen − The number of characters to use in the comparison.ReturnThe strncmp() 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 −8192ExampleLet us see another example − Live DemoOutputThe following is the output −-32

strncasecmp() function in PHP

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

74 Views

The strncasecmp() function is used to compare two strings. Note − The function is case-insensitive. Syntax strncasecmp(str1,str2,len) Parameters str1 − First string to compare str2 − Second string to compare len − The length of strings to be used while comparing 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

strnatcmp() function in PHP

Samual Sam
Updated on 26-Dec-2019 09:04:37

95 Views

The strnatcmp() function is used compare two strings with a natural order algorithm.Syntaxstrnatcmp(str1, str2)Parametersstr1 − First string to compare.str2 − Second string to compareReturnThe strnatcmp() 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 −1ExampleLet us see another example − Live DemoOutputThe following is the output −-1 1 0

strnatcasecmp() function in PHP

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

94 Views

The strnatcasecmp() function is used compare two strings with a natural algorithm. Note − The function is case sensitive. Syntax strnatcasecmp(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 -1 1 0

strlen() function in PHP

karthikeya Boyini
Updated on 26-Dec-2019 09:24:59

12K+ Views

The strlen() function is used to get the string length. It returns the length of the string on success. If the string is empty, 0 is returned.Syntaxstrlen(str)Parametersstr − The string for which we want the length.ReturnThe strlen() function returns the length of the string on success. If the string is empty, 0 is returned.ExampleThe following is an example − Live DemoOutputThe following is the output −10

stripslashes() function in PHP

Samual Sam
Updated on 26-Dec-2019 09:24:08

244 Views

The stripslashes() function is used to un-quote a quoted string.Syntaxstripslashes(str)Parametersstr − Specify the string.ReturnThe stripslashes() function returns a string with backslashes stripped off i.e '\' becomes '. The double backslashes (\) are form into a single backslash (\).ExampleThe following is an example − Live DemoOutputThe following is the output −Tom Hanks

stristr() function in PHP

Ankith Reddy
Updated on 24-Jun-2020 13:46:20

188 Views

The stristr() function is used to search for the first occurrence of a string inside another string.Note − The function is case-insensitiveSyntaxstristr(str, search, before_search)Parametersstr − The string to search insearch − The string to search forbefore_search − A boolean value whose default is "false". If set to "true", it returns the part of the string before the first occurrence of the search parameter.ReturnThe stristr() function returns the matched substring.ExampleThe following is an example − Live DemoOutputTim is not in the string!ExampleThe following is an example − Live DemoOutputDemo

stripos() function in PHP()

Arjun Thakur
Updated on 30-Jul-2019 22:30:23

222 Views

The stripos() function is used to find the position of first occurrence of a string inside the another string. Note − The function is case-insensitive. Syntax stripos(str, search, begin) Parameters str − The string to search in search − The string to search begin − Where to begin the search Return The stripos() function returns the position of the first occurrence of a string inside another string. Example The following is an example − Live Demo Output 0

stripcslashes() function in PHP

karthikeya Boyini
Updated on 30-Jul-2019 22:30:23

195 Views

The stripclashes() is used to remove backslashes. It returns the unescaped string. Syntax stripclashes(str) Parameters str − Specify the string to check. Return The stripcslashes() function returns the unescaped string. The following is an example − Example Live Demo The following is the output − Output Naomi Watts!

strip_tags() function in PHP

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

134 Views

The strip_tags() function is used to strip HTML and PHP tags from a string. Syntax strip(str, allow) Parameters str − The string to check allow − The allowable tags that won’t be removed (won’t be stripped). Return The strip_tags() function returns the stripped string. Example The following is an example − Live Demo Output Demo Text! Example The following is an example − Live Demo Output Demo Text!>/strong>

Advertisements