[PHP] practical function 5_PHP tutorial-php Tutorial

Source: Internet
Author: User
Tags ereg
[PHP] function 5. Convert the binary representation of a number into a hexadecimal stringbin2hex (stringtring). Remove the space stringrtrim (stringstring) at the end of the string) rtrim alias stringchop (s // converts the binary representation of a number into a hexadecimal format

String bin2hex (string tring)
// Remove spaces at the end of the string

String rtrim (string)
// Rtrim alias

String chop (string)
// Remove spaces from both ends of the string

String trim (string)
// Remove spaces from the beginning of the string

String ltrim (string)
// Use the string separator to split the string and return the components of the string in the array.

Array explode (string separator, string)
// Add the glue string between the elements of the array pieces to combine the elements and return a string

String implode (string glue, array pieces)
// Converts a string to uppercase.

String strtoupper (string)
// Converts a string to lowercase.

String strtolower (string)
// Convert the same strings in str and from into strings in to and return

String strtr (string str, string from, string)
// Locate the first occurrence (case-insensitive) position of the character in one string in another string

Int strpos (string haystack, string needle, int [offset])
// Locate the last occurrence position of the character in the string in the other string. it is worth noting that the needle can only be one character,
Chinese characters are not suitable

Int strrpos (string haystack, char needle)
// Convert the string to a short segment for other functions. For example, base64_encode. The parameter chunklen (76 characters) is specified at intervals.
Insert end ("") with 76 characters (""). Returns a new string without modifying the original string.

String chunck_split (string, int [chunklen], string [end])
// Extract the start character of the string from the start character. If start is a negative number
. If the parameter length that can be omitted exists but is negative, it indicates that the maximum length is obtained.

String substr (string, int start, int [length])
// The following characters in the returned string are preceded by a backslash (\):. \ + *? [^] ($)

String quotemeta (string str)
// Returns the ASCII (American National Standard exchange code) value of the string. This function is opposite to the chr () function.

Int ord (string)
// Convert the ASCII code into one character

String chr (int ascii)
// Uppercase the first character of a string

String ucfirst (string str)
// Uppercase the first character of each word in a string

String ucwords (string str)
// Compare the two strings to the same degree, and return the number of identical character sequences (chars) in the Two Strings. by using the 3rd
The referenced variable is used to pass the percentage of similar characters to the 3rd parameters.

Int similar_text (string first, string second, double [percent]
// Escape single quotes, double quotation marks, and backslash characters in a single character with a backslash

String addslashes (string str)
// Remove the backslash from the string

String stripslashes (string str)
// Use the pattern rule to analyze and compare the string. The value returned from the comparison result is placed in the array parameter regs. regs [0]
The content is the original string, regs [1] is the first regular string, and regs [2] is the second regular string.
, And so on. If the regs parameter is omitted, only comparison is performed. if it is found, the return value is true.

Int ereg (string pattern, string, array) [regs])
// Similar to ereg (), the difference is that ereg () is case-sensitive. This function is case-insensitive.

Int eregi (string pattern, string, array [regs])
// This function uses the pattern rule to analyze and compare string. the character to be replaced is the parameter replacement. Return value
String type

String ereg_replace (string pattern, string replacement, string)
// Construct a case-insensitive replacement regular expression

String eregi_replace (string pattern, string replacement, string)
// The returned value is an array variable. The pattern parameter is the specified rule string and the string parameter is the string to be processed.
The limit parameter can be omitted, indicating the maximum value to be processed. It is worth noting that the pattern parameter of this function is case sensitive.

Array split (string pattern, string, int [limit])
// This function returns the character strings in case. In PHP usage, this function has no effect, but it may provide
Processing of a program or database.

String SQL _regcase (string)
// Store data in byte-stream mode. The variable value is a hybrid type, which can include integers, double-precision floating-point string, array
And object attributes (the object method is not saved)

String serialize (mixed value)
// Extract data stored in byte-stream mode.

Mixed unserialize (string str)

Stringbin2hex (stringtring) // Remove the space stringrtrim (stringstring) at the end of the string // The alias stringchop (s...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.