[PHP] Utility function 5_php Tutorial

Source: Internet
Author: User
Converts a binary representation of a number to hexadecimal

String Bin2Hex (String tring)
Remove space at the end of a string

String RTrim (String string)
Aliases for RTrim

String Chop (String string)
Remove spaces from both ends of a string

String Trim (String string)
Remove a space from the beginning of a string

String LTrim (String string)
Use string separator to split string strings and return components of string strings in the array

Array explode (string separator,string string)
Combine elements and return a string by adding glue strings between the elements of the array pieces.

String implode (string Glue,array pieces)
Make a string uppercase

String Strtoupper (String string)
Make a string into lowercase

String Strtolower (String string)
Converts the same string one by one in the string str and from in to the string in to and returns

String Strtr (String str,string from,string to)
Finds the first occurrence (not case) of a character in a string in another string

int Strpos (string haystack,string needle,int [offset])
Find the last occurrence of a character in a string in another string, it is worth noting that needle can only be a single character,
Chinese characters do not fit

int Strrpos (String Haystack,char needle)
Turns a string into a small segment for use by other functions. For example, Base64_encode. The default is the parameter Chunklen (76 characters) every
76 Characters Insert End (""). Returns a new string without altering the original string.

String Chunck_split (String string,int[chunklen],string[end])
Takes the string starting at the start of the string to take a length character. If start is negative, from the end of the string
Count. If the omitted parameter length exists, but is negative, it is taken to the penultimate length character

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

String Quotemeta (String str)
Returns the ASCII (U.S. National Standard Interchange Code) ordinal value of a string. This function is the opposite of the CHR () function

int ord (String string)
Convert ASCII code into one character

string chr (int ascii)
Capitalize the first character of a string

String Ucfirst (String str)
Capitalize the first character of each word in a string

String Ucwords (String str)
Comparing two characters to the same degree, returns the number of the same sequence of characters (chars) in two strings, by using the 3rd parameter
The reference variable given, passing a percentage of similar characters to the 3rd argument

int Similar_text (string first,string second,double[percent]
To escape single quotes, double quotes, and backslash characters in one character with backslashes

String addslashes (String str)
To remove a backslash from a string

String stripslashes (String str)
Using the rules of pattern to parse string strings compared to the value returned by the results of the array parameter regs, Regs[0]
The content is the original string, Regs[1] is the first rule-conforming string, regs[2] is the second rule-conforming string
And so on If the parameter regs is omitted, it is simply a comparison, and the return value is true if found

int Ereg (string pattern,string string,array) [regs])
Similar to Ereg (), except that Ereg () is case-sensitive and the function is not case-insensitive

int eregi (string pattern,string String,array[regs])
This function parses string strings with the rule of pattern, and the character to be substituted is the parameter replacement. return value
is a String type

String Ereg_replace (String pattern,string replacement,string string)
Constructs a case-insensitive replacement regular expression

String Eregi_replace (String pattern,string replacement,string string)
The return value after the cut is an array variable. Parameter pattern is the specified rule string, the argument string is the string to be processed
, the parameter limit can be omitted, indicating the maximum value to be processed. It is important to note that the pattern parameter of this function is case-sensitive

Array Split (String pattern,string String,int[limit])
This function returns the character of a string verbatim to case. This function has no effect on PHP usage, but may provide external
procedures or database processing.

String Sql_regcase (String string)
Store the data in a byte-stream manner. The variable value is a mixed type and can include integers, double-precision floating-point string, array to
And the properties of the object (the method of the object is not saved)

String serialize (mixed value)
Data that can be removed from the system and stored in Byte-stream mode

Mixed unserialize (String str)

http://www.bkjia.com/PHPjc/318605.html www.bkjia.com true http://www.bkjia.com/PHPjc/318605.html techarticle //Convert a binary representation of a number to hex Stringbin2hex (stringtring)//Remove the space at the end of the string Stringrtrim (stringstring)//rtrim 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.