Return value: string
Function types: Operating system and environment
Content description: This function is used to configure the information of the region. Parameter category has the following choices:
LC_ALL includes all the following options.
LC_COLLATE configuration string comparison, PHP has not yet implemented this item.
LC_CTYPE Configure character categories and conversions. For example, strtoupper() is fully capitalized.
LC_MONETARY configurable financial currency, PHP has not yet been implemented.
LC_NUMERIC Configure the number of digits after the decimal point.
LC_TIME Configure the time and date format, and is used in conjunction with strftime().
If the parameter locate is an empty string "", the value of the system environment variable locate or LANG will be used. If locate is zero, the regional configuration will not be changed. Return to the new region, and return false if the system has not implemented any implementation.
Usage example
Michal Fita <manveru@> proposed this example of regionalization using Poland at 11-Jan-1999 11:01.
<?
setlocale("LC_ALL", "pl");
$net = "1234,56";
$gross = "1,22" * $net;
printf("Gross profit: %s, Net profit: %s", $gross, $net");
/* Polish total?/font>[VAT is 22%*/
?>
The return value is
Gross profit: 1234,56, Net profit: 1506,1632
Return value: integer
Function type: Data processing
Content description
This function is used to calculate the similarity of two strings.
Return value: string
Function type: Data processing
Content description: The Soundex value is a value obtained using the pronunciation approximation of English characters. The value consists of four characters, the first character is an English letter, and the last three are numbers. Sometimes in pinyin text, you can pronounce it but cannot spell out the correct words. Especially when you are a search engine, when facing the English strings passed by users, you can use this function to make a fuzzy comparison effect. For example, the two strings Knuth and Kant have the soundex values of both H416. For more detailed instructions, please refer to the master’s masterpiece Donald Knuth: The Art Of Computer Programming (The Art Of Computer Programming) Volume 3 sorting and searching.
Usage example
<?
$str1=soundex("Wilson");
$str2=soundex("Waillsume");
echo "soundex(\"Wilson\")=$str1 equal to\n";
echo "soundex(\"Waillsume\")=$str2\n";
echo "The values are $str1";
?>
The string returned in the above example is
soundex("Wilson")=W425 equals
soundex("Waillsume")=W425
All values are W425
Return value: string
Function type: Data processing
Content description: This function is used to format strings. The parameter format is the format of the conversion, starting with the percentage symbol % until the characters are converted. The conversion format includes
Fill in the blanks. If 0 is the space, fill in 0; the space is the default value, which means that the space is placed.
Alignment. The default value is right-aligned and the negative sign table is left-aligned.
Field width. is the minimum width.
Accuracy. Refers to the number of floating point digits after the decimal point.
Type, see the table below % Print out the percentage symbol and do not convert it.
b Integer converted into binary.
c Integer converted to the corresponding ASCII characters.
d The integer is converted into decimal places.
F times the accuracy number is converted into a floating point number.
o The integer is converted into octal.
s Integer converted into a string.
x integer converted to lowercase hexadecimal.
X integer is converted to capital hexadecimal.
Usage example
<?
$money1 = 68.75;
$money2 = 54.35;
$money = $money1 + $money2;
// At this time the variable $money value is "123.1";
$formatted = sprintf ("%01.2f", $money);
// At this time the variable $ formatted value is "123.10"
?>
Return value: string
Function type: Data processing
Content description: This function is also the strstr() function.
Return value: integer
Function type: Data processing
Content description: This function is used to compare the size of two strings. Returns a negative number that means str1 is less than str2; returns a positive number that means str1 is greater than str2; returns a zero that means two strings are the same.
Reference: ereg() substr() strstr()
Return value: integer
Function type: Data processing
Content description: This function is used to compare two strings and calculate the length of the string at different places.
Reference: strrspn()
Syntax: string strip_tags(string str);
Return value: string
Function type: Data processing
Content description: This function can remove any HTML and PHP tag strings contained in the string. If the HTML and PHP tags of the string are wrong, for example, if the symbol greater than is missing, an error will also be returned. This function has the same function as fgetss().
Return value: string
Function type: Data processing
Content description: This function can remove backslash characters in strings. If there are two consecutive backslashes, remove one and leave one. If there is only one backslash, remove it directly.
Reference: addslashes()
Return value: integer
Function type: Data processing
Content description: This function returns the specified string length.
Return value: integer
Function type: Data processing
Content description: This function is used to find the last location of the character needle in the string haystack. It is worth noting that the needle can only be one character, and Chinese characters are not suitable. If the specified character cannot be found, the false value is returned.
Reference: strpos() strrchr() substr() strstr() strstr()
Return value: integer
Function type: Data processing
Content description: This function is used to find the first location where the character needle in the string haystack appears. It is worth noting that the needle can only be one character, and Chinese characters are not suitable. If the specified character cannot be found, the false value is returned. The parameter offset can be omitted and used to Y means to start looking from offset.
Reference: strrpos() strrchr() substr() strstr() strstr()
Return value: integer
Function type: Data processing
Content description: This function is used to find the last occurrence position of the character needle in the string haystack, and return the string between this position and the end of the string haystack. If no needle is found, return false.
Usage example
The following example retrieves the last path of the environment variable PATH
<?php
$dir = substr( strrchr( $PATH, ":" ), 1 );
echo "The last path is:".$dir;
?>
Reference: substr() strstr()
Return value: string
Function type: Data processing
Content description: Reverse the string before and after.
Usage example
The return string in the following example is "gneP nosliW"
<?
$str=strrev("Wilson Peng");
echo $str;
?>
Return value: integer
Function type: Data processing
Content description: This function uses the str2 string as a mask, which can be used to calculate that several characters in the str1 string fall into the str2 mask.
Reference: strcspn()
Return value: string
Function type: Data processing
Content description: This function returns the string from the first appearance of the needle at haystack to the end of haystack. If the needle cannot be found, return false.
Reference: strrchr() substr() ereg()
Return value: string
Function type: Data processing
Content description: This function cuts the string arg1 into small segments of string arg2 according to the value of the string arg2.
Usage example: This example cuts the I will be back string into blank space.
<?php
$string = "I will be back";
$tok = strtok($string," ");
while($tok) {
echo "Single word=$tok<br>";
$tok = strtok(" ");
}
?>
Reference: split() exploit()
Return value: string
Function type: Data processing
Content description: This function turns all strings str into lowercase strings.
Reference: strtoupper() ucfirst()
Return value: string
Function type: Data processing
Content description: This function converts all strings str to uppercase strings.
Reference: strtolower() ucfirst()
Return value: string
Function type: Data processing
Content description: This function substitutes the string str into the haystack string and replaces all the needs with str. mlevine@ (11-Apr-1999) pointed out that in PHP version 3.0.7, there are some bugs in this function, while in PHP version 3.0.8, the function will be restored normally.
Usage example
The following example replaces %body% with black
<?php
$bodytag = str_replace("%body%", "black", "<body text=%body%>");
echo $bodytag;
?>
Reference: ereg_replace()
Return value: string
Function type: Data processing
Content description: This function converts the characters related to the string str and from one into characters of to one.
Reference: ereg_replace()
Return value: string
Function type: Data processing
Content description: This function takes the string starting from the start bit of the string string, string, length characters. If start is a negative number, it starts from the end of the string. If the omitted parameter length exists but is a negative number, it means that the last length character is taken.
Usage example
<?
echo substr("abcdef", 1, 3); // Return "bcd"
echo substr("abcdef", -2); // Return "ef"
echo substr("abcdef", -3, 1); // Return "d"
echo substr("abcdef", 1, -1); // Return "bcde"
?>
Reference: strrchr() ereg()
Return value: string
Function type: Data processing
Content description: This function returns the string string after the whitespace character at the beginning and end of the string is removed.
Reference: chop() ltrim()
Return value: string
Function type: Data processing
Content description: This function returns the string str The first letter of the first character is changed to capital.
Reference: strtoupper() strtolower()
Return value: string
Function type: Data processing
Content description: This function returns the string str. All the initial letters of each character are changed to capitalization.
Previous page12Read the full text