Summary of common php string functions. 1. the formatted output chop is the alias of rtrim (); ltrim () trim () nl2br () converts n to brprint, echo, printf (), sprintf (): echo () it is not a function. print () is a function and has returned values,
Compare the php version of the discuz and ecshop truncation string functions. The following describes the source code and simple test of the two versions of functions. at last, I will provide a more practical string truncation function. Note: The
This article mainly introduces ThinkPHP string functions and common functions for developers to refer to. if you need them, you can refer to this article to summarize ThinkPHP string processing functions and other common functions, for reference by
--string function. Returns the ASII code of the leftmost letter of the stringPrint ASCII (' ABCDE ')Print ASCII (')Print char (--ASCII) conversion between code and characters--*charindex The starting index of the corresponding character segment in
1. String Functions--Converts the average height to ASC CodeSelect ASCII (AVG (Shengao)) from SG--Converts the maximum weight to a character typeSelect CHAR (MAX (Tizhong)) from SG--Returns a string of four-bit soundex codeSelect SOUNDEX (' LSKD ')--
Function syntax
Len (string | varname) returns the number of characters in the string or the number of bytes required to store a variable.
Trim trim (string) removes spaces before and after the string
Ltrim (string) removes spaces before the
Addslashes: Adds a slash to the string.Bin2hex: binary to hexadecimal.Chop: removes consecutive gaps.Chr: returns the character of the ordinal value.Chunk_split: splits a string into segments.Convert_cyr_string: convert the ancient Slavic string to
Search and replace in a string:S.find (substr, [Start, [end]]) #返回S中出现substr的第一个字母的标号, returns 1 if there is no substr in S. Start and End function is equivalent to searching in s[start:end]S.index (substr, [Start, [end]]) is the same #与find (), but
Common character string functions in php (3) Replace str_replace () with substrings and phpstr_replace
MixedStr_replace(Mixed$search, Mixed$replace, Mixed$subject[, Int&$count]);
This function returns a string or array. This string or array
a function of judging typeIs_bool()//to determine whether it is a Boolean typeis_float()//determines whether a floating-point typeIs_real()//Ibid .Is_int()//determine if the integer typeIs_integer()//Ibid .is_string()//determines whether a
1.1 functions on array manipulation1.1.1Range (start,end)Creates an array with values starting from start and ending at endIf the parameter in range is a number, then he sorts it directly in the order of the number size, and if the argument is a
String is a finite sequence composed of zero or multiple characters. It is generally recorded as s = 'a1a2 • an '(n> = 0 ). It is the data type that represents text in programming languages.
Generally, the entire string is used as the operation
MySQL (9) -- string functions (2)(8) Delete the TRIM (s1 FROM s) function of the specified string)
TRIM (s1 FROM s2) deletes all substrings s1 at both ends of string s. S1 is an optional direction. If no direction is specified, spaces are
A String or String is a finite sequence composed of zero or multiple characters. It is generally recorded as sa1a2an (n0 ). It is the data type that represents text in programming languages. Generally, the entire string is used as the operation
There are many ways to use the string functions in PHP, including the following:(1) echo, print, printf, sprintfThe first two functions are output strings. If there is a variable name in the string, it is replaced with its value.The last two
String common functions, string functions
// Specify the character list to escape all characters in the listAddcslashes (string $ str, string $ charlist );Echo addcslashes ('foo [] ', 'a. Z ');// Output: \ f \ o \ [\]// Escape all characters of the
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.