Found 35164 Articles for Programming

vprintf() function in PHP

karthikeya Boyini
Updated on 26-Dec-2019 10:18:02

15 Views

The vprintf() function is used to convert string to formatted string. It outputs a formatted string.Syntaxvprintf(format, arg)Parametersforma − Specifies the string and how to format the variables in it.The following are the possible format values −%% - Returns a percent sign%b - Binary number%c - The character according to the ASCII value%d - Signed decimal number (negative, zero or positive)%e - Scientific notation using a lowercase (e.g. 1.2e+2)%E - Scientific notation using a uppercase (e.g. 1.2E+2)%u - Unsigned decimal number (equal to or greater than zero)%f - Floating-point number (local settings aware)%F - Floating-point number (not local settings aware)%g - ... Read More

vfprintf() function in PHP

George John
Updated on 24-Jun-2020 13:57:31

14 Views

The vfprintf() function is used to convert formatted string to specific output. It returns the length of the outputted string.Syntaxvfprintf(stream, format, arg)Parametersstream  − Specifies where to output the stringformat  − Specifies the string and how to format the variables in it.The following are the possible format values −%%  − Returns a percent sign%b  − Binary number%c  − The character according to the ASCII value%d  − Signed decimal number (negative, zero or positive)%e  − Scientific notation using a lowercase (e.g. 1.2e+2)%E  − Scientific notation using a uppercase (e.g. 1.2E+2)%u  − Unsigned decimal number (equal to or greater than zero)%f  − Floating-point ... Read More

ucwords() function in PHP

Samual Sam
Updated on 26-Dec-2019 10:16:42

123 Views

The ucwords() function is used to convert the first character of a string to uppercase in each string.Syntaxucwords(str)Parametersstr − The specified stringReturnThe ucfirst() function returns the converted string.ExampleThe following is an example − Live DemoOutputThe following is the output −This Is It!ExampleLet us see another example − Live DemoOutputThe following is the output −#demo#text

ucfirst() function in PHP

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

62 Views

The ucfirst() function is used to convert the first character of a string to uppercase. Syntax ucfirst(str) Parameters str − The specified string Return The ucfirst() function returns the converted string. Example The following is an example − Live Demo Output Demo

trim() function in PHP

karthikeya Boyini
Updated on 26-Dec-2019 10:15:19

238 Views

The trim() function is used to remove whitespaces and other characters.Syntaxtrim(str, charlist):Parametersstr − Specify the string to check.charlist − Specifies which characters to remove. If this parameter isn’t used, then any of the following characters are removed −"\0" - NULL"\t" - tab"" - new line"\x0B" - vertical tab"\r" - carriage returnReturnThe trim() function returns the modified string.ExampleThe following is an example − Live DemoOutputThe following is the output −Trim: Demo text!ExampleLet us see another example − Live DemoOutputThe following is the output −emo text

substr() function in PHP

Ankith Reddy
Updated on 24-Jun-2020 13:50:07

522 Views

The substr() function is used to return a part of a string.Syntaxsubstr(str, begin, len)Parametersstr − The stringbegin − Specifies where to begin in the stringA positive number  − Start at a specified position in the stringA negative number  − Start at a specified position from the end of the string0  − Start at the first character in stringlen  − Specifies the length of the returned string. Default is to the end of the string.A positive number  − The length to be returned from the start parameterNegative number  − The length to be returned from the end of the stringReturnThe substr() ... Read More

substr_replace() function in PHP

Samual Sam
Updated on 26-Dec-2019 10:12:14

1K+ Views

The substr_replace() function is used to replace the part of string with another string.Syntaxsubstr_replace(str, replacement, begin, len)Parametersstr − The string to checkreplacement − The string to insertbegin − The position from where the replacement begins −If begin is a positive number: Begin replacing at the specified position in the stringIf begin is a n number: - Begin replacing at the specified position from the end of the stringif begin is 0 - Begin replacing at the first character in the string.len − The number of characters to be replaced. The default is the same length as the string.If len is ... Read More

substr_count() function in PHP

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

101 Views

The substr_count() function is used to count the number of sub-strings. Syntax substr_count(str,substr,begin,len) Parameters str − The string to check substr − The string to search for begin − Where to begin searching in the string len − The length of the search Return The substr_count() function returns the number of times substring occurs in the string. Example The following is an example − Live Demo Output 20 1

substr_compare() function in PHP

karthikeya Boyini
Updated on 26-Dec-2019 10:09:30

54 Views

The substr_compare() function is used to compare two string format with a specific start position.Syntaxsubstr_compare(str1, str2, offset, len, case_insensitive)Parametersstr1 − The first string to comparestr2 − The second string to compareoffset − The start position for the comparison. If negative, the counting begins from the end of the string.len − The length of the first string to comparecase_insensitive − If case_insensitivity is TRUE, comparison is case insensitive.ReturnThe substr_compare() function returns −0 - if the two strings are equal0 - if string1 (from offset) is greater than string2If length is equal or greater than length of string1, this function returns FALSE.ExampleThe ... Read More

strtr() function in PHP

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

38 Views

The strstr() is used to translate a character or replace substring. Syntax strstr(str, from, to) or strstr(str, arr) Parameters str − The string to translate from − The characters to change. A required parameter if array is not used. to − The characters to change into. A required parameter if array is not used. arr − Array containing what to change from as key, and what to change to as value Return The strstr() function returns the translated string. Example The following is an example − Live Demo Output tom han

Advertisements