Friday, 26 June 2015

The Ultimate PHP String Functions List

1. substr() definition: The substr() function returns a part of a string.

Usage: If you know where the information that you want lies in a larger string, you can extract it out with the substr() function.

substr function signature substr(string, start, length)

Argument Argument Meaning
string Mandatory. Specifies the string to return a part of
start Mandatory. Specifies where to start in the string
  • A positive number – Start at a specified position in the string
  • A negative number – Start at a specified position from the end of the string
  • 0 – Start at the first character in string
length Not Mandatory. 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 parameter
  • Negative number – The length to be returned from the end of the string

Code Example

iPhone 6 – is cool, just don’t bend it

2. strlen() definition: The strlen() function returns to us the number of characters in the string it’s given.

Usage: There are many times when you will need to know the length of a string. The strlen() function makes this super easy for us.

strlen function signature strlen(string)

Argument Argument Meaning
string Mandatory. This is the string that we will check the length of.

Code Example

79

3. sprintf() definition: The sprintf() function returns a string created by filling format with the given arguments.

Usage: The sprintf() function can be used to assign a formatted string to a variable. The arg1, arg2, ++ parameters are inserted at the percent (%) signs in the main string. sprintf() works in a step by step fashion meaning at the first % sign, arg1 is inserted, at the second % sign, arg2 is inserted, and so on.

sprintf function signature sprintf(format, arg1, arg2, arg++)

Argument Argument Meaning
format Mandatory. Specifies the string and how to format the variables in it. 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 greather than zero)
  • %f – Floating-point number (local settings aware)
  • %F – Floating-point number (not local settings aware)
  • %g – shorter of %e and %f
  • %G – shorter of %E and %f
  • %o – Octal number
  • %s – String
  • %x – Hexadecimal number (lowercase letters)
  • %X – Hexadecimal number (uppercase letters)
Additional format values. These are placed between the % and the letter (example %.2f):
  • + (Forces both + and – in front of numbers. By default, only negative numbers are marked)
  • ‘ (Specifies what to use as padding. Default is space. Must be used together with the width specifier. Example: %’x20s (this uses “x” as padding)
  • – (Left-justifies the variable value)
  • [0-9] (Specifies the minimum width held of to the variable value)
  • .[0-9] (Specifies the number of decimal digits or maximum string length)
Note: If multiple additional format values are used, they must be in the same order as above.
arg1 Mandatory. The argument to be inserted at the first %-sign in the format string
arg2 Not Mandatory. The argument to be inserted at the second %-sign in the format string
arg++ Not Mandatory. The argument to be inserted at the third, fourth, etc. %-sign in the format string

Code Example

Hello there, President Business

4. echo() definition: The echo() function outputs strings and information to the browser.

Usage: You’ll make use of echo() constantly. Technically, echo() is not actually a function but a language construct. As such, in almost all use cases you will omit the parenthesis entirely.

echo function signature echo(strings)

Argument Argument Meaning
strings Mandatory. One or more strings to be sent to the output

Code Example

I am chilling with a Snapple Iced Tea.
Isn’t that pretty cool?
Why yes, Yes it is Mr. Brickowski.
This small snippet shows how we can echo out strings to the screen. We used double quotes to make use of interpolation for these examples.

5. strpos() definition: The strpos() function returns the position of the first occurrence of find in string. If specified, the function begins its search at position start. Returns false if find is not found.

Usage: You can use the strpos() function to find the first occurrence of a small string in a larger string and if the small string isn’t found, strpos() returns false.

strpos function signature strpos(string, find, start)

Argument Argument Meaning
string Mandatory. Specifies the string to search
find Mandatory. Specifies the string to find
start Not Mandatory. Specifies where to begin the search

Code Example

7
The code above uses a string of characters that represent numbers as a string. These are not real numbers, they are of type string not int or float! We simply use this to illustrate that when using this function the very first character in a string starts with zero. For every single character including any whitespace, the number increments by one. We start at the first position of 0 in the example, but had we started at 8 for example, then the function would have returned false since it was looking for 7, but started looking at the eighth position so it already missed it.

6. implode() definition: The implode() function does the exact opposite of explode() – it creates a large string from an array of smaller strings.

Usage: Returns a string created by joining every element in the array with separator.

implode function signature implode(separator, array)

Argument Argument Meaning
separator Not Mandatory. Specifies what to put between the array elements. Default is “” (an empty string)
array Required. The array to join to a string

Code Example

iPhone @@ Macbook @@ Lenovo Ultrabook @@ Vacation at Cape Cod

7. str_replace() definition: The str_replace() function replaces some characters with some other characters in a string.

Usage: Searches for all occurrences of find in string and replaces them with replace. If all three parameters are strings, a string is returned. If string is an array, the replacement is performed for every element in the array and an array of results is returned. If find and replace are both arrays, elements in find are replaced with the elements in replace with the same numeric indices. Finally, if find is an array and replace is a string, any occurrence of any element in find is changed to replace. If supplied, count is filled with the number of instances replaced.

str_replace function signature str_replace(find, replace, string, count)

Argument Argument Meaning
find Mandatory. Specifies the value to find
replace Mandatory. Specifies the value to replace the value in find
string Mandatory. Specifies the string to be searched
count Not Mandatory. A variable that counts the number of replacements

Code Example

Array
(
[0] => You like to have a fantastic time
[1] => You are a really nice person
[2] => Do you like to drink Starbucks?
)

8. strtolower() definition: The strtolower() function turns a mixed case string into all lowercase characters.

Usage: Returns string with all alphabetic characters converted to lowercase. The table used for converting characters is locale-specific.

strtolower function signature strtolower(string)

Argument Argument Meaning
string Mandatory. Specifies the string that we will convert to all lowercase.

Code Example

buddy can you turn off the caps lock key?!

9. explode() definition: The explode() function breaks apart a string into an array.

Usage: If you know where the information that you want lies in a larger string, you can extract it out with the explode() function.

explode function signature explode(separator, string, limit)

Argument Argument Meaning
separator Mandatory. Specifies where to break the string
string Mandatory. The string to split
limit Not Mandatory. Specifies the number of array elements to return. Possible values:
  • Greater than 0 – Returns an array with a maximum of limit element(s)
  • Less than 0 – Returns an array except for the last -limit elements()
  • 0 – Returns an array with one element

Code Example

Array
(
[0] => Your
[1] => mind
[2] => is
[3] => so
[4] => prodigiously
[5] => empty
[6] => that
[7] => there
[8] => is
[9] => simply
[10] => nothing
[11] => left
[12] => to
[13] => empty
[14] => out.
)

10. chr() definition: The chr() function returns a character when you pass it an ASCII value.

Usage: Returns a string consisting of the single ASCII character ascii.

chr function signature chr(ascii)

Argument Argument Meaning
ascii Mandatory. An ASCII value

Code Example

!”#nopR

11. trim() definition: The trim() function cleans a string of all whitespace or other specified characters.

Usage: Returns string with every whitespace character in charlist stripped from the beginning and end of the string. You can specify a range of characters to strip using .. within the string. For example, a..z would strip each lowercase alphabetical character. If charlist is not supplied, n, r, t, x0B, , and spaces are stripped.

trim function signature trim(string, charlist)

Argument Argument Meaning
string Mandatory. Specifies the string to check
charlist Not Mandatory. Specifies which characters to remove from the string. If left out, all of the following characters are removed:
  • “” – NULL
  • “t” – tab
  • “n” – new line
  • “x0B” – vertical tab
  • “r” – carriage return
  • ” ” – ordinary white space

Code Example

This is a cool string with some nonsense characters at the start and end, not to mention some really strange whitespace characters

12. str_repeat() definition: The str_repeat() function repeats a string a specified number of times..

Usage: Returns a string consisting of repeat copies of string appended to each other. If repeat is not greater than 0, an empty string is returned.

str_repeat function signature substr(string, repeat)

Argument Argument Meaning
string Mandatory. Specifies the string to repeat
repeat Mandatory. Specifies the number of times the string will be repeated. Must be greater or equal to 0

Code Example

Everything is Awesome! Everything is Awesome! Everything is Awesome!

13. strtoupper() definition: The strtoupper() function returns a string with all of it’s characters converted to uppercase.

Usage: If you know where the information that you want lies in a larger string, you can extract it out with the strtoupper() function.

strtoupper function signature strtoupper(string)

Argument Argument Meaning
string Mandatory. Specifies the string to be converted to uppercase.

Code Example

hey buddy, sorry I didn’t get my caffeine yet, but hold up – i’ll drink some now…. … ten minutes later… WOW I FEEL AWESOME!!!

14. str_pad() definition: The str_pad() function pads a string to a new length.

Usage: Pads string using pad_string until it is at least length characters and returns the resulting string. By specifying pad_type, you can control where the padding occurs..

str_pad function signature str_pad(string, length, pad_string, pad_type)

Argument Argument Meaning
string Mandatory. Specifies the string to pad
length Mandatory. Specifies the new string length. If this value is less than the original length of the string, nothing will be done
pad_string Not Mandatory. Specifies the string to use for padding. Default is whitespace
pad_type Not Mandatory. Specifies what side to pad the string. Possible values:
  • STR_PAD_BOTH – Pad to both sides of the string. If not an even number, the right side gets the extra padding
  • STR_PAD_LEFT – Pad to the left side of the string
  • STR_PAD_RIGHT – Pad to the right side of the string. This is default

Code Example

Microsoft owns Minecraft wow!wow!wow!wow!wow!wow!wow!

15. ord() definition: The ord() function returns the ASCII value of the first character of a string.

Usage: Returns the ASCII value of the first character in string.

ord function signature ord(string)

Argument Argument Meaning
string Mandatory. The string to get an ASCII value from

Code Example

84 | 116 | 72

16. strtok() definition: The strtok() function splits a string into smaller strings called tokens.

Usage: Breaks string into tokens separated by any of the characters in split and returns the next
token found. The first time you call strtok() on a string, use the first function prototype; afterward, use the second, providing only the tokens. The function contains an internal pointer for each string it is called with.

strtok function signature strtok(string, split) and strtok(split)

Argument Argument Meaning
string Mandatory. Specifies the string to split
split Mandatory. Specifies one or more split characters

Code Example

Please
make
sure
to
follow
the
instructions
(or
you’ll
be
put
to
sleep).

17. strtr() definition: The strtr() function translates certain characters in a string.

Usage: When given three arguments, returns a string created by translating in string every occurrence of a character in from to the character in to with the same position. When given two arguments, returns a string created by translating occurrences of the keys in array in string with the corresponding values in array.

strtr function signature strtr(string, from, to) and strtr(string, array)

Argument Argument Meaning
string Mandatory. Specifies the string to translate
from Required (unless array is used). Specifies what characters to change
to Required (unless array is used). Specifies what characters to change into
array Required (unless to and from is used). An array containing what to change from as key, and what to change to as value

Code Example

Do you need some help right now?

18. rtrim() definition: The rtrim() function removes whitespace or other predefined characters from the right side of a string.

Usage: Returns string with all characters in charlist stripped from the end. If charlist is not specified, the characters stripped are n, r, t, v, , and spaces..

rtrim function signature rtrim(string, charlist)

Argument Argument Meaning
string Mandatory. Specifies the string to check
charlist Not Mandatory. Specifies which characters to remove from the string. If left out, all of the following characters are removed:
  • “” – NULL
  • “t” – tab
  • “n” – new line
  • “x0B” – vertical tab
  • “r” – carriage return
  • ” ” – ordinary white space

Code Example

The prophecy states you are the most interesting person in the world.

19. md5() definition: The md5() function calculates the MD5 hash of a string.

Usage: Calculates the MD5 encryption hash of string and returns it. If the raw option is true then the MD5 hash returned is in raw binary format (length of 16), binary defaults to false, thus making MD5 return a full 32-character hex string.

md5 function signature md5(string, raw)

Argument Argument Meaning
string Mandatory. The string to be calculated
raw Not Mandatory. Specifies hex or binary output format:
  • TRUE – Raw 16 character binary format
  • FALSE – Default. 32 character hex number

Code Example

78e382eb9b9b8c265bb10d3bce8e1608

20. strrpos() definition: The strrpos() function finds the position of the last occurrence of a string inside another string.

Usage: Returns the position of the last occurrence of find in string, or false if find is not found.
If specified and positive, the search begins start characters from the start of string. If specified and negative, the search begins start characters from the end of string.

strrpos function signature strrpos(string, find, start)

Argument Argument Meaning
string Mandatory. Specifies the string to search
find Mandatory. Specifies the string to find
start Not Mandatory. Specifies where to begin the search

Code Example

The last position of ‘awesome’ is at position 82

21. join() definition: The join() function returns a string from the elements of an array.

Usage: The join() function is simply an alias for implode().

join function signature join(separator, array)

Argument Argument Meaning
separator Not Mandatory. Specifies what to put between the array elements. Default is “” (an empty string)
array Mandatory. The array to join to a string

Code Example

This @@ does @@ the same @@ thing as implode()

22. bin2hex() definition: The bin2hex() function returns a part of a string.

Usage: Converts string to a hexadecimal (base-16) value. Up to a 32-bit number, or 2,147,483,647 decimal, can be converted.

bin2hex function signature bin2hex(string)

Argument Argument Meaning
string Mandatory. Specifies the string to be converted to hex

Code Example

4920616d206e6f77206e6f7468696e67206d6f7265207468616e20686578

23. ltrim() definition: The ltrim() function removes whitespace or other predefined characters from the left side of a string.

Usage: Returns string with all characters in charlist stripped from the beginning. If charlist is not specified, the characters stripped are n, r, t, v, , and spaces..

ltrim function signature ltrim(string, charlist)

Argument Argument Meaning
string Mandatory. Specifies the string to check
charlist Not Mandatory. Specifies which characters to remove from the string. If left out, all of the following characters are removed:
  • “” – NULL
  • “t” – tab
  • “n” – new line
  • “x0B” – vertical tab
  • “r” – carriage return
  • ” ” – ordinary white space

Code Example

The prophecy states you are the most interesting person in the world.

24. substr_replace() definition: The substr_replace() function replaces a part of a string with another string.

Usage: Replaces a substring in string with replacement. The substring replaced is selected using the same rules as those of substr(). If string is an array, replacements take place on each string within the array. In this case, replacement, start, and length can either be scalar values, which are used for all strings in string, or arrays of values to be used for each corresponding value in string.

substr_replace function signature substr_replace(string, replacement, start, length)

Argument Argument Meaning
string Mandatory. Specifies the string to check
replacement Mandatory. Specifies the string to insert
start Mandatory. Specifies where to start replacing in the string
  • A positive number – Start replacing at the specified position in the string
  • Negative number – Start replacing at the specified position from the end of the string
  • 0 – Start replacing at the first character in the string
length Not Mandatory. Specifies how many characters should be replaced. Default is the same length as the string.
  • A positive number – The length of string to be replaced
  • A negative number – How many characters should be left at end of string after replacing
  • 0 – Insert instead of replace

Code Example

Goooooood Morning New York!!
Goooooood Morning Boston!!

25. str_split() definition: The str_split() function splits a string into an array.

Usage: Splits string into an array of characters, each containing length characters; if length is not specified, it defaults to 1.

str_split function signature str_split(string, start, length)

Argument Argument Meaning
string Mandatory. Specifies the string to split
length Not Mandatory. Specifies the length of each array element. Default is 1

Code Example

Array
(
[0] => S
[1] => P
[2] => A
[3] => C
[4] => E
[5] => S
[6] => H
[7] => I
[8] => P
[9] => !
)

26. sha1() definition: The sha1() function returns a part of a string.

Usage: Calculates the sha1 encryption hash of string and returns it. If raw is set and is true, the
raw binary is returned instead of a hex string.

sha1 function signature sha1(string, raw)

Argument Argument Meaning
string Mandatory. The string to be calculated
raw Not Mandatory. Specify hex or binary output format:
  • TRUE – Raw 20 character binary format
  • FALSE – Default. 40 character hex number

Code Example

Hey bud, what’s your password? You: Oh it’s 5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8. – Let me know if you have any trouble logging in.

27. ucfirst() definition: The ucfirst() function returns a part of a string.

Usage: Returns string with the first character, if alphabetic, converted to uppercase. The table used for converting characters is locale-specific.

ucfirst function signature ucfirst(string)

Argument Argument Meaning
string Mandatory. Specifies the string to apply an uppercase first letter to.

Code Example

Super cool

28. chunk_split() definition: The chunk_split() function splits a string into a series of smaller parts.

Usage: If you know where the information that you want lies in a larger string, you can extract it out with the chunk_split() function.

chunk_split function signature chunk_split(string, length, end)

Argument Argument Meaning
string Mandatory. Specifies the string to split
length Not Mandatory. A number that defines the length of the chunks. Default is 76
end Not Mandatory. A string that defines what to place at the end of each chunk. Default is rn

Code Example

Eat:-) th:-)e L:-)eaf:-)y G:-)ree:-)ns :-)for:-) go:-)od :-)hea:-)lth:-).:-)

29. ucwords() definition: The ucwords() function converts the first character of each word in a string to uppercase.

Usage: If you’d like to turn the first character of every word into uppercase, this function will do that for you.

ucwords function signature ucwords(string)

Argument Argument Meaning
string Mandatory. Specifies the string to convert to uppercase for the first character of each word.

Code Example

Ten Reasons To Check Out The Latest Article On Something!

30. htmlspecialchars() definition: The htmlspecialchars() function converts some predefined characters to HTML entities.

Usage: When you need to convert actual HTML into the entities that make up that HTML, this function can do that for you.

htmlspecialchars function signature htmlspecialchars(string, flags, character-set, double_encode)

Argument Argument Meaning
string Mandatory. Specifies the string to convert
flags Not Mandatory. Specifies how to handle quotes, invalid encoding and the used document type. The available quote styles are:
  • ENT_COMPAT – Default. Encodes only double quotes
  • ENT_QUOTES – Encodes double and single quotes
  • ENT_NOQUOTES – Does not encode any quotes
Invalid encoding:
  • ENT_IGNORE – Ignores invalid encoding instead of having the function return an empty string. Should be avoided, as it may have security implications.
  • ENT_SUBSTITUTE – Replaces invalid encoding for a specified character set with a Unicode Replacement Character U+FFFD (UTF-8) or &#FFFD; instead of returning an empty string.
  • ENT_DISALLOWED – Replaces code points that are invalid in the specified doctype with a Unicode Replacement Character U+FFFD (UTF-8) or &#FFFD;
Additional flags for specifying the used doctype:
  • ENT_HTML401 – Default. Handle code as HTML 4.01
  • ENT_HTML5 – Handle code as HTML 5
  • ENT_XML1 – Handle code as XML 1
  • ENT_XHTML – Handle code as XHTML
character-set Not Mandatory. A string that specifies which character-set to use. Allowed values are:
  • UTF-8 – Default. ASCII compatible multi-byte 8-bit Unicode
  • ISO-8859-1 – Western European
  • ISO-8859-15 – Western European (adds the Euro sign + French and Finnish letters missing in ISO-8859-1)
  • cp866 – DOS-specific Cyrillic charset
  • cp1251 – Windows-specific Cyrillic charset
  • cp1252 – Windows specific charset for Western European
  • KOI8-R – Russian
  • BIG5 – Traditional Chinese, mainly used in Taiwan
  • GB2312 – Simplified Chinese, national standard character set
  • BIG5-HKSCS – Big5 with Hong Kong extensions
  • Shift_JIS – Japanese
  • EUC-JP – Japanese
  • MacRoman – Character-set that was used by Mac OS
Note: Unrecognized character-sets will be ignored and replaced by ISO-8859-1 in versions prior to PHP 5.4. As of PHP 5.4, it will be ignored an replaced by UTF-8.
double_encode Not Mandatory. A boolean value that specifies whether to encode existing html entities or not.
  • TRUE – Default. Will convert everything
  • FALSE – Will not encode existing html entities

Code Example

<b>Look at me, I am bold</b>. No, no actually you are not, you have been special chared.

31. stripos() definition: The stripos() function finds the position of the first occurrence of a string inside another string.

Usage: Returns the position of the first occurrence of find in string using case-insensitive comparison. If specified, the function begins its search at position start. Returns false if find is not found.

stripos function signature stripos(string, find, start)

Argument Argument Meaning
string Mandatory. Specifies the string to search
find Mandatory. Specifies the string to find
start Not Mandatory. Specifies where to begin the search

Code Example

You’re in luck because with stripos() I can tell you it is at 21

32. substr_count() definition: The substr_count() function counts the number of times a substring occurs in a string.

Usage: Returns the number of times substring appears in string. If start is provided, the search begins at that character offset for at most length characters, or until the end of the string if length is not provided.

substr_count function signature substr_count(string, substring, start, length)

Argument Argument Meaning
string Mandatory. Specifies the string to check
substring Mandatory. Specifies the string to search for
start Not Mandatory. Specifies where in string to start searching
length Not Mandatory. Specifies the length of the search

Code Example

How about that, you said awesome 7 times!

33. number_format() definition: The number_format() function formats a number with grouped thousands.

Usage: Creates a string representation of number. If decimals is given, the number is rounded to that many decimal places; the default is no decimal places, creating an integer. If decimalpoint and separator are provided, they are used as the decimal-place character and thousands separator, respectively.

number_format function signature number_format(number, decimals, decimalpoint, separator)

Argument Argument Meaning
number Mandatory. The number to be formatted. If no other parameters are set, the number will be formatted without decimals and with comma (,) as the thousands separator.
decimals Not Mandatory. Specifies how many decimals. If this parameter is set, the number will be formatted with a dot (.) as decimal point
decimalpoint Not Mandatory. Specifies what string to use for decimal point
separator Not Mandatory. Specifies what string to use for thousands separator. Only the first character of separator is used. For example, “xxx” will give the same output as “x” Note: If this parameter is given, all other parameters are required as well

Code Example

The company has 5,500.26 in reserve.

34. stripcslashes() definition: The stripcslashes() function removes backslashes added by the addcslashes() function.

Usage: When you need to clean up data retrieved from a database or from an HTML form, this function works great.

stripcslashes function signature stripcslashes(string)

Argument Argument Meaning
string Mandatory. Specifies the string to clean.

Code Example

Friend what you have is one dirty string

35. strstr() definition: The strstr() function searches for the first occurrence of a string inside another string.

Usage: Returns the portion of string from the first occurrence of search until the end of string, or from the first occurrence of search until the beginning of string if before_search is specified
and true. If search is not found, the function returns false. If search contains more than one character, only the first is used.

strstr function signature strstr(string, search, before_search)

Argument Argument Meaning
string Mandatory. Specifies the string to search
search Mandatory. Specifies the string to search for. If this parameter is a number, it will search for the character matching the ASCII value of the number
before_search Not Mandatory. 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.

Code Example

great open source software community.

36. wordwrap() definition: The wordwrap() function wraps a string into new lines when it reaches a specific length.

Usage: Inserts break into string every width characters and at the end of the string and returns the resulting string. While inserting breaks, the function attempts to not break in the middle of a word. If not specified, break defaults to n and size defaults to 75. If cut is given and is true, the string is always wrapped to the given width

wordwrap function signature wordwrap(string, width, break, cut)

Argument Argument Meaning
string Mandatory. Specifies the string to break up into lines
width Not Mandatory. Specifies the maximum line width. Default is 75
break Not Mandatory. Specifies the characters to use as break. Default is “n”
cut Not Mandatory. Specifies whether words longer than the specified width should be wrapped:
  • FALSE – Default. No-wrap
  • TRUE – Wrap

Code Example

Sometimes you will have a
string that is quite long and
in cases like that you can use
the wordwrap function to make
it easier to work with.

37. addcslashes() definition: The addcslashes() function returns a string with backslashes in front of the specified characters.

Usage: Returns escaped instances of characters in string by adding a backslash before them. You
can specify ranges of characters by separating them with two periods; for example, to escape characters between a and q, use "a..q". Multiple characters and ranges can be specified in characters.

addcslashes function signature addcslashes(string, characters)

Argument Argument Meaning
string Mandatory. Specifies the string to be escaped
characters Mandatory. Specifies the characters or range of characters to be escaped

Code Example

Hi Traveler, thanks for stopping by!
Hi Traveler, thanks for stopping by!
Hi Traveler, thanks for stopping by!
Green energy is getting more important everyday!
Green energy is getting more important everyday!
Green energy is getting more important everyday!
Green energy is getting more important everyday!

38. parse_str() definition: The parse_str() function parses a query string into variables.

Usage: Parses string as if coming from an HTTP POST request, setting variables in the local scope
to the values found in the string. If array is given, the array is set with keys and values from the string.

parse_str function signature parse_str(string, array)

Argument Argument Meaning
string Mandatory. Specifies the string to parse
array Not Mandatory. Specifies the name of an array to store the variables. This parameter indicates that the variables will be stored in an array.

Code Example

Blue
Subaru
wrx

39. strcmp() definition: The strcmp() function compares two strings.

Usage: Compares two strings; returns a number less than 0 if stringone is less than stringtwo, 0 if the two strings are equal, and a number greater than 0 if stringone is greater than stringtwo. The comparison is case sensitive meaning, “Alphabet” and “alphabet” are not considered equal.

strcmp function signature strcmp(stringone, stringtwo)

Argument Argument Meaning
stringone Mandatory. Specifies the first string to compare
stringtwo Mandatory. Specifies the second string to compare

Code Example

0 – 1 – 1

40. strip_tags() definition: The strip_tags() function strips a string from HTML, XML, and PHP tags.

Usage: Removes PHP and HTML tags from string and returns the result. The allow parameter can
be specified to not remove certain tags. The string should be a comma-separated list of the tags to ignore; for example, "<b>,<i>" will leave bold and italic tags.

strip_tags function signature strip_tags(string, allow)

Argument Argument Meaning
string Mandatory. Specifies the string to check
allow Not Mandatory. Specifies allowable tags. These tags will not be removed

Code Example

41. substr_compare() definition: The substr() function returns a part of a string.

41. substr_compare() definition: The substr_compare() function compares two strings from a specified start position.

Usage: Compares stringone, starting at the position startpos, to stringtwo. If length is specified, a maximum of that many characters are compared. Finally, if case is specified and true, the comparison is case-insensitive. Returns a number less than 0 if the substring of stringone is less than stringtwo, 0 if they are equal, and a number greater than 0 if the substring of stringone is greater than stringtwo.

substr_compare function signature substr_compare(stringone, starttwo, startpos, length, case)

Argument Argument Meaning
stringone Mandatory. Specifies the first string to compare
stringtwo Mandatory. Specifies the second string to compare
startpos Mandatory. Specifies where to start comparing in string1. If negative, it starts counting from the end of the string
length Not Mandatory. Specifies how much of string1 to compare
case Not Mandatory. A boolean value that specifies whether or not to perform a case-sensitive compare:
  • FALSE – Default. Case-sensitive
  • TRUE – Case-insensitive

Code Example

The substrings are equal!

42. setlocale() definition: The setlocale() function sets locale information which refers to language, monetary, time and other information specific for a geographical area.

Usage: Sets the locale for constant functions to location. Returns the current location after being set, or false if the location cannot be set. Any number of options for constant can be added (or ORed) together.

setlocale function signature setlocale(constant, location)

Argument Argument Meaning
constant Mandatory. Specifies what locale information should be set. Available constants:
  • LC_ALL – All of the below
  • LC_COLLATE –  Sort order
  • LC_CTYPE – Character classification and conversion (e.g. all characters should be lower or upper-case)
  • LC_MESSAGES – System message formatting
  • LC_MONETARY – Monetary/currency formatting
  • LC_NUMERIC – Numeric formatting
  • LC_TIME – Date and time formatting
location Mandatory. Specifies what country/region to set the locale information to. Can be a string or an array. It is possible to pass multiple locations. If the location is NULL or the empty string “”, the location names will be set from the values of environment variables with the same names as the constants above, or from “LANG”.
If the location is “0”, the location setting is not affected, only the current setting is returned.
If the location is an array, setlocale() will try each array element until it finds a valid language or region code. This is very useful if a region is known under different names on different systems.

Code Example

English_United States.1252

43. str_ireplace() definition: The str_ireplace() function replaces some characters with some other characters in a string.

Usage: Performs a case-insensitive search for all occurrences of find in string and replaces them
with replace. If all three parameters are strings, a string is returned. If string is an array, the
replacement is performed for every element in the array and an array of results is returned. If find and replace are both arrays, elements in find are replaced with the elements in replace with the same numeric indices. Finally, if find is an array and replace is a string, any occurrence of any element in find is changed to replace. If supplied, count is filled with the number of instances replaced.

str_ireplace function signature str_ireplace(find, replace, string, count)

Argument Argument Meaning
find Mandatory. Specifies the value to find
replace Mandatory. Specifies the value to replace the value in find
string Mandatory. Specifies the string to be searched
count Not Mandatory. A variable that counts the number of replacements

Code Example

Array
(
[0] => wicked awesome
[1] => mildy interesting
[2] => really fun
[3] => boring as ever
)
We made 1 replacements!

44. strncasecmp() definition: The strncasecmp() function compares two strings.

Usage: Compares two strings; returns a number less than 0 if stringone is less than stringtwo, 0 if the two strings are equal, and a number greater than 0 if stringone is greater than stringtwo. The comparison is case insensitive meaning, “Alphabet” and “alphabet” are considered equal. This function is a case insensitive version of strcmp(). If either string is shorter than length characters, the length of that string determines how many characters are compared.

strncasecmp function signature strncasecmp(stringone, stringtwo, length)

Argument Argument Meaning
stringone Mandatory. Specifies the first string to compare
stringtwo Mandatory. Specifies the second string to compare
length Mandatory. Specify the number of characters from each string to be used in the comparison

Code Example

0
0

45. crypt() definition: The crypt() function returns a string encrypted using DES, Blowfish, or MD5 algorithms.

Usage: Encrypts str using the DES encryption algorithm seeded with the two-character salt value salt. If salt is not supplied, a random salt value is generated the first time crypt() is called
in a script; this value is used on subsequent calls to crypt(). Returns the encrypted string.

crypt function signature crypt(str, salt)

Argument Argument Meaning
str Mandatory. Specifies the string to be encoded
salt Not Mandatory. A string used to increase the number of characters encoded, to make the encoding more secure. If the salt argument is not provided, one will be randomly generated by PHP each time you call this function.

Code Example

Can you guess what the characters of my password are? You can use $2a$10$1qAz2wSx3eDc4rFv5tGb5eByw4KQDygkPgOmhrh8p0Ix50i4Pujwm for a hint.

46. printf() definition: The printf() function outputs a formatted string.

Usage: Outputs a string created by using format and the given arguments. The arguments are placed into the string in various places denoted by special markers in the format string. Each marker starts with a percent sign (%) and consists of the following elements, in order. Except for the type specifier, the specifiers are all optional. To include a percent sign in the string, use %%.

printf function signature printf(format, arg1, arg2, arg++)

Argument Argument Meaning
format Mandatory. Specifies the string and how to format the variables in it. 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 greather than zero)
  • %f – Floating-point number (local settings aware)
  • %F – Floating-point number (not local settings aware)
  • %g – shorter of %e and %f
  • %G – shorter of %E and %f
  • %o – Octal number
  • %s – String
  • %x – Hexadecimal number (lowercase letters)
  • %X – Hexadecimal number (uppercase letters)
Additional format values. These are placed between the % and the letter (example %.2f):
  • + (Forces both + and – in front of numbers. By default, only negative numbers are marked)
  • ‘ (Specifies what to use as padding. Default is space. Must be used together with the width specifier. Example: %’x20s (this uses “x” as padding)
  • – (Left-justifies the variable value)
  • [0-9] (Specifies the minimum width held of to the variable value)
  • .[0-9] (Specifies the number of decimal digits or maximum string length)
Note: If multiple additional format values are used, they must be in the same order as above.
arg1 Mandatory. The argument to be inserted at the first %-sign in the format string
arg2 Not Mandatory. The argument to be inserted at the second %-sign in the format string
arg++ Not Mandatory. The argument to be inserted at the third, fourth, etc. %-sign in the format string

Code Example

68.00F is 20.00C

47. quoted_printable_decode() definition: The quoted_printable_decode() function decodes a quoted-printable string to an 8-bit ASCII string.

Usage: Decodes string, which is data encoded using the quoted printable encoding, and returns the resulting string.

quoted_printable_decode function signature quoted_printable_decode(string)

Argument Argument Meaning
string Mandatory. Specifies the quoted-printable string to be decoded

Code Example

Behold
the
Quoted
Printable
Decode.

48. sscanf() definition: The sscanf() function parses input from a string according to a specified format.

Usage: The sscanf() function decomposes a string according to a printf()– like template

sscanf function signature sscanf(string, format, arg1, arg2, arg++)

Argument Argument Meaning
string Mandatory. Specifies the string to read
format Mandatory. Specifies the format to use. Possible format values:
  • %% – Returns a percent sign
  • %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)
  • %u – Unsigned decimal number (equal to or greather than zero)
  • %f – Floating-point number
  • %o – Octal number
  • %s – String
  • %x – Hexadecimal number (lowercase letters)
  • %X – Hexadecimal number (uppercase letters)
Additional format values. These are placed between the % and the letter (example %.2f):
  • + (Forces both + and – in front of numbers. By default, only negative numbers are marked)
  • ‘ (Specifies what to use as padding. Default is space. Must be used together with the width specifier. Example: %’x20s (this uses “x” as padding)
  • – (Left-justifies the variable value)
  • [0-9] (Specifies the minimum width held of to the variable value)
  • .[0-9] (Specifies the number of decimal digits or maximum string length)
Note: If multiple additional format values are used, they must be in the same order as above.
arg1 Not Mandatory. The first variable to store data in
arg2 Not Mandatory. The second variable to store data in
arg++ Not Mandatory. The third, fourth, and so on, to store data in

Code Example

Array
(
[0] => Lenovo
[1] => Ultrabook
[2] => 400
)

49. crc32() definition: The crc32() function calculates a 32-bit CRC (cyclic redundancy checksum) for a string.

Usage: Calculates and returns the cyclic redundancy checksum (CRC) for string.

crc32 function signature crc32(string)

Argument Argument Meaning
string Mandatory. The string to be calculated

Code Example

2184231086

50. htmlentities() definition: The htmlentities() function converts characters to HTML entities.

Usage: Converts all characters in string that have special meaning in HTML and returns the resulting string. All entities defined in the HTML standard are converted. If supplied, flags determines the manner in which quotes are translated.

htmlentities function signature htmlentities(string, flags, character-set, double_encode)

Argument Argument Meaning
string Mandatory. Specifies the string to convert
flags Not Mandatory. Specifies how to handle quotes, invalid encoding and the used document type. The available quote styles are:
  • ENT_COMPAT – Default. Encodes only double quotes
  • ENT_QUOTES – Encodes double and single quotes
  • ENT_NOQUOTES – Does not encode any quotes
Invalid encoding:
  • ENT_IGNORE – Ignores invalid encoding instead of having the function return an empty string. Should be avoided, as it may have security implications.
  • ENT_SUBSTITUTE – Replaces invalid encoding for a specified character set with a Unicode Replacement Character U+FFFD (UTF-8) or &#FFFD; instead of returning an empty string.
  • ENT_DISALLOWED – Replaces code points that are invalid in the specified doctype with a Unicode Replacement Character U+FFFD (UTF-8) or &#FFFD;
Additional flags for specifying the used doctype:
  • ENT_HTML401 – Default. Handle code as HTML 4.01
  • ENT_HTML5 – Handle code as HTML 5
  • ENT_XML1 – Handle code as XML 1
  • ENT_XHTML – Handle code as XHTML
character-set Not Mandatory. A string that specifies which character-set to use. Allowed values are:
  • UTF-8 – Default. ASCII compatible multi-byte 8-bit Unicode
  • ISO-8859-1 – Western European
  • ISO-8859-15 – Western European (adds the Euro sign + French and Finnish letters missing in ISO-8859-1)
  • cp866 – DOS-specific Cyrillic charset
  • cp1251 – Windows-specific Cyrillic charset
  • cp1252 – Windows specific charset for Western European
  • KOI8-R – Russian
  • BIG5 – Traditional Chinese, mainly used in Taiwan
  • GB2312 – Simplified Chinese, national standard character set
  • BIG5-HKSCS – Big5 with Hong Kong extensions
  • Shift_JIS – Japanese
  • EUC-JP – Japanese
  • MacRoman – Character-set that was used by Mac OS
Note: Unrecognized character-sets will be ignored and replaced by ISO-8859-1 in versions prior to PHP 5.4. As of PHP 5.4, it will be ignored an replaced by UTF-8.
double_encode Not Mandatory. A boolean value that specifies whether to encode existing html entities or not.
  • TRUE – Default. Will convert everything
  • FALSE – Will not encode existing html entities

Code Example


51. levenshtein() definition: The levenshtein() function returns the Levenshtein distance between two strings.

Usage: Calculates the Levenshtein distance between two strings. This is the number of characters you have to replace, insert, or delete to transform stringone into stringtwo. By default, replacements, inserts, and deletes have the same cost, but you can specify different costs with insert, replace, and delete.

levenshtein function signature levenshtein(stringone, stringtwo, insert, replace, delete)

Argument Argument Meaning
stringone Mandatory. First string to compare
stringtwo Mandatory. Second string to compare
insert Not Mandatory. The cost of inserting a character. Default is 1
replace Not Mandatory. The cost of replacing a character. Default is 1
delete Not Mandatory. The cost of deleting a character. Default is 1

Code Example

Avenues to Awesome has a Levenshtein distance of 5

52. strcasecmp() definition: The strcasecmp() function compares two strings.

Usage: Compares two strings; returns a number less than 0 if stringone is less than stringtwo, 0 if the two strings are equal, and a number greater than 0 if stringone is greater than stringtwo. The comparison is case insensitive meaning, “Alphabet” and “alphabet” are considered equal.

strcasecmp function signature strcasecmp(stringone, stringtwo)

Argument Argument Meaning
stringone Mandatory. Specifies the first string to compare
stringtwo Mandatory. Specifies the second string to compare

Code Example

0
0

53. strcspn() definition: The strcspn() function returns the number of characters (including whitespaces) found in a string before any part of the specified characters are found.

Usage: Returns the length of the subset of string starting at start, examining a maximum of length characters, to the first instance of a character from char.

strcspn function signature strcspn(string, char, start, length)

Argument Argument Meaning
string Mandatory. Specifies the string to search
char Mandatory. Specifies the characters to search for
start Not Mandatory. Specifies where in string to start
length Not Mandatory. Specifies the length of the string (how much of the string to search)

Code Example

There are 19 letters before the exclamation point.

54. strripos() definition: The strripos() function finds the position of the last occurrence of a string inside another string.

Usage: Returns the position of the last occurrence of find in string using a case-insensitive search,
or false if find is not found. If specified and positive, the search begins start characters
from the start of string. If specified and negative, the search begins start characters from
the end of string. This function is a case-insensitive version of strrpos().

strripos function signature strripos(string, find, start)

Argument Argument Meaning
string Mandatory. Specifies the string to search
find Mandatory. Specifies the string to find
start Not Mandatory. Specifies where to begin the search

Code Example

The last occurrence of ‘doo’ is at position 38.

55. strspn() definition: The strspn() function returns the number of characters found in the string that contains only characters from the charlist parameter.

Usage: Returns the length of the substring in string that consists solely of characters in charlist. If start is positive, the search starts at that character; if it is negative, the substring starts at the character start characters from the string’s end. If length is given and is positive, that many characters from the start of the substring are checked. If length is given and is negative, the check ends length characters from the end of string.

strspn function signature strspn(string, charlist, start, length)

Argument Argument Meaning
string Mandatory. Specifies the string to search
charlist Mandatory. Specifies the characters to find
start Not Mandatory. Specifies where in the string to start
length Not Mandatory. Defines the length of the string

Code Example

1

56. html_entity_decode() definition: The html_entity_decode() function converts HTML entities to characters.

Usage: Converts all HTML entities in string to the equivalent character. All entities defined in the HTML standard are converted. If supplied, flags determines the manner in which quotes are translated. The possible values for flags are the same as those for htmlentities. If supplied, character-set determines the final encoding for the characters. The possible values for character-set are the same as those for htmlentities.

html_entity_decode function signature html_entity_decode(string, flags, character-set)

Argument Argument Meaning
string Mandatory. Specifies the string to decode
flags Not Mandatory. Specifies how to handle quotes and which document type to use. The available quote styles are:
  • ENT_COMPAT – Default. Decodes only double quotes
  • ENT_QUOTES – Decodes double and single quotes
  • ENT_NOQUOTES – Does not decode any quotes
Additional flags for specifying the used doctype:
  • ENT_HTML401 – Default. Handle code as HTML 4.01
  • ENT_HTML5 – Handle code as HTML 5
  • ENT_XML1 – Handle code as XML 1
  • ENT_XHTML – Handle code as XHTML
character-set Not Mandatory. A string that specifies which character-set to use. Allowed values are:
  • UTF-8 – Default. ASCII compatible multi-byte 8-bit Unicode
  • ISO-8859-1 – Western European
  • ISO-8859-15 – Western European (adds the Euro sign + French and Finnish letters missing in ISO-8859-1)
  • cp866 – DOS-specific Cyrillic charset
  • cp1251 – Windows-specific Cyrillic charset
  • cp1252 – Windows specific charset for Western European
  • KOI8-R – Russian
  • BIG5 – Traditional Chinese, mainly used in Taiwan
  • GB2312 – Simplified Chinese, national standard character set
  • BIG5-HKSCS – Big5 with Hong Kong extensions
  • Shift_JIS – Japanese
  • EUC-JP – Japanese
  • MacRoman – Character-set that was used by Mac OS

Code Example

©®™


57. str_shuffle() definition: The str_shuffle() function randomly shuffles all the characters of a string.

Usage: Rearranges the characters in string into a random order and returns the resulting string.

str_shuffle function signature str_shuffle(string)

Argument Argument Meaning
string Mandatory. Specifies the string to shuffle

Code Example


echo str_shuffle("This is a message from space.");
?>

58. stristr() definition: The stristr()searches for the first occurrence of a string inside another string.

Usage: This is the case insensitive version of strstr().

stristr function signature stristr(string, search, before_search)

Argument Argument Meaning
string Mandatory. Specifies the string to search
search Mandatory. Specifies the string to search for. If this parameter is a number, it will search for the character matching the ASCII value of the number
before_search Not Mandatory. 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.

Code Example

great open source software community.

59. strpbrk() definition: The strpbrk() function searches a string for any of the specified characters.

Usage: Returns a string consisting of the substring of string, starting from the position of the first instance of a character from charlist in string to the end of the string, or false if none of the characters in charlist is found in string.

strpbrk function signature strpbrk(string, charlist)

Argument Argument Meaning
string Mandatory. Specifies the string to search
charlist Mandatory. Specifies the characters to find

Code Example

Jack Flash is a Gas!

60. strrev() definition: The strrev() function reverses a string.

Usage: If you need to know how to spell something backwards, this is the function for you..

strrev function signature strrev(string)

Argument Argument Meaning
string Mandatory. Specifies the string to reverse.

Code Example

Awesome spelled backwards is emosewA

61. addslashes() definition: The addslashes() function returns a string with backslashes in front of predefined characters.

Usage: Returns escaped instances of characters in string by adding a backslash before them. You can specify ranges of characters by separating them with two periods; for example, to escape characters between b and o, use "b..o". Multiple characters and ranges can be specified in characters.

addslashes function signature addslashes(string)

Argument Argument Meaning
string Mandatory. Specifies the string to be escaped.

Code Example

Tim said, “This is the best stuff so far”

62. count_chars() definition: The count_chars() function returns information about characters used in a string

Usage: Returns the number of occurrences of each byte value from 0–255 in stringmode determines the form of the result.

count_chars function signature count_chars(string, mode)

Argument Argument Meaning
string Required. The string to be checked
mode Not Mandatory. Specifies the return modes. 0 is default. The different return modes are:
  • 0 – an array with the ASCII value as key and number of occurrences as value
  • 1 – an array with the ASCII value as key and number of occurrences as value, only lists occurrences greater than zero
  • 2 – an array with the ASCII value as key and number of occurrences as value, only lists occurrences equal to zero are listed
  • 3 – a string with all the different characters used
  • 4 – a string with all the unused characters

Code Example

?CGHMacdehiklmnoprstuwxy

63. md5_file() definition: The md5_file() function calculates the MD5 hash of a file.

Usage: Calculates and returns the MD5 encryption hash for the file at file. An MD5 hash is a 32-character hexadecimal value that can be used to checksum a file’s data. If raw is supplied and is true, the result is sent as a 16-bit binary value instead.

md5_file function signature substr(file, raw)

Argument Argument Meaning
file Mandatory. The file to be calculated
raw Not Mandatory. A boolean value that specifies hex or binary output format:
  • TRUE – Raw 16 character binary format
  • FALSE – Default. 32 character hex number

Code Example

453753ba5c6198a03deaa724b58c3eec

64. nl2br() definition: The nl2br() function inserts HTML line breaks (<br> or <br />) in front of each newline (n) in a string.

Usage: If xhtml is true, then nl2br will use XHTML-compatible line breaks..

nl2br function signature nl2br(string, xhtml)

Argument Argument Meaning
string Mandatory. Specifies the string to check
xhtml  Not Mandatory. A boolean value that indicates whether or not to use XHTML compatible line breaks:
  • TRUE- Default. Inserts <br />
  • FALSE – Inserts <br>

Code Example

This is a piece of text on line 1.
Yet this text is on line 2.

65. sha1_file() definition: The sha1_file() function calculates the SHA-1 hash of a file.

Usage: Calculates and returns the sha1 encryption hash for the file at file. A sha1 hash is a 40-character hexadecimal value that can be used to checksum a file’s data. If raw is supplied and is true, the result is sent as a 20-bit binary value instead.

sha1_file function signature sha1_file(file, raw)

Argument Argument Meaning
file Mandatory. The file to be calculated
raw Not Mandatory. A boolean value that specifies hex or binary output format:
  • TRUE – Raw 20 character binary format
  • FALSE – Default. 40 character hex number

Code Example

f9515988673aae7dc5552d24c06ce947684c6bbb

66. str_word_count() definition: The str_word_count() function returns a part of a string.

Usage: Counts the number of words in string using locale-specific rules. The value of return dictates the returned value.

str_word_count function signature str_word_count(string, return, char)

Argument Argument Meaning
string Mandatory. Specifies the string to check
return Not Mandatory. Specifies the return value of the str_word_count() function. Possible values:
  • 0 – Default. Returns the number of words found
  • 1 – Returns an array with the words from the string
  • 2 – Returns an array where the key is the position of the word in the string, and value is the actual word
char Not Mandatory. Specifies special characters to be considered as words.

Code Example

There are 10 words in the sentence ‘Super Mario is all you need to have a blast!

67. strnatcasecmp() definition: The strnatcasecmp() function compares two strings using a natural order algorithm.

Usage: Compares two strings with case insensitivity and returns a number less than 0 if stringone is less than stringtwo, 0 if the two strings are equal, and a number greater than 0 if stringone is greater than stringtwo.

strnatcasecmp function signature strnatcasecmp(stringone, stringtwo)

Argument Argument Meaning
stringone Mandatory. Specifies the first string to compare
stringtwo Mandatory. Specifies the second string to compare

Code Example





68. strnatcmp() definition: The strnatcmp() function compares two strings using a natural order algorithm.

Usage: Compares two strings with case sensitivity and returns a number less than 0 if stringone is less than stringtwo, 0 if the two strings are equal, and a number greater than 0 if stringone is greater than stringtwo.

strnatcmp function signature strnatcmp(string,start,length)

Argument Argument Meaning
stringone Mandatory. Specifies the first string to compare
stringtwo Mandatory. Specifies the second string to compare

Code Example





69. strncmp() definition: The strncmp() function compares two strings.

Usage: This function works just like strcmp() function, except that strcmp() does not have the length parameter.

strncmp function signature strncmp(stringone, stringtwo, length)

Argument Argument Meaning
stringone Mandatory. Specifies the first string to compare
stringtwo Mandatory. Specifies the second string to compare
length Mandatory. Specify the number of characters from each string to be used in the comparison

Code Example

Since $equal is equal, the value is 0. Since $notequal is not equal, the value is 1.

70. chop() definition: The chop() function removes whitespaces or other predefined characters from the right end of a string.

Usage: This works just like the rtrim() function.

chop function signature chop(string, charlist)

Argument Argument Meaning
string Mandatory. Specifies the string to check
charlist Not Mandatory. Specifies which characters to remove from the string.
The following characters are removed if the charlist parameter is empty:
  • “” – NULL
  • “t” – tab
  • “n” – new line
  • “x0B” – vertical tab
  • “r” – carriage return
  • ” ” – ordinary white space

Code Example

You really are the most interesting person in the world.

0 comments:

Post a Comment