Function usageInt preg_match_all (string pattern, string subject, array matches [, int flags])Example 1 The code is as follows:Copy code Preg_match_all ("| ] +> (. *) ] +> | U "," example: this is a test ", $ out, PREG_SET_ORDER );Print $
SyntaxStrtotime (time, now) parameter descriptionTime specifies the time string to be parsed.Now is used to calculate the timestamp of the returned value. If this parameter is omitted, the current time is used.Example The code is as follows:Copy
The code is as follows:Copy code $ Str = "Remove leading and trailing spaces ";Echo "the original string is in square brackets: [". $ str. "] ";Echo "original string length:". strlen ($ str). " ";$ Str1 = ltrim ($ str );Echo "length after ltrim (
/* Function definition:* 1. The function is named* 2. Independent code segments* 3. The Function executes a specific task.* 4. You can return a value to the program that calls it. ** Advantages of functions:* 1. Improve program reusability* 2.
How to replace some characters in a custom string in the php TutorialThe substr_replace () function replaces some characters in the custom string.Syntax: substr_replace (str, repl, start, [int length])Syntax description:Str -- required parameter,
The timestamp is used here.Mktime (hour, minute, second, month, day, year, [is_dst])The parameter can be omitted from the right to the left, and any omitted parameter will be set to the current value of the local date and time. Parameter
Php Tutorial substr_replace replacing specified location characters and memory corruption vulnerabilityTips and commentsNote: If start is a negative number and the length is less than or equal to start, the length is 0.$ Username = "zongzi ";Echo
Introduction to filter in php TutorialPhp filters are used to verify and filter data from unsafe sources (such as user input.InstallThe filter function is a core component of php. These functions can be used without installation.Php filter
The opendir () function is used to open the directory handle.If the function runs successfully, a set of directory streams (a set of directory strings) are returned. If the function fails, an error [error] is returned. You can add "@" at the
SyntaxBase_convert (number, frombase, tobase) parameter descriptionNumber is required. Original value.Frombase is required. The original hexadecimal number.Tobase is required. The hexadecimal format to be converted.*/$ Hexadecimal = 'a37334 ';Echo
$ Values = array (40, 50, // coordinates of the first vertex20,240, // coordinates of the first vertex60, 60, // coordinates of the first vertex, 20, // coordinates of the first vertex50, 40, // coordinates of the first vertex10, 10 // coordinates
Sort arraysThe usort () function uses a user-defined function to sort arrays.*/Function cmp ($ a, $ B) // user-defined callback function{If ($ a ==$ B) // if the two parameters are equal {Return 0; // return 0 }Return ($ a> $ B )? -; // If the
*/$ Array = array ("size" => "xl", "color" => "gold"); // defines an arrayPrint_r (array_values ($ array); // outputs all values of the array./*Definition and usageThe array_values () function returns an array containing all the key values in the
The returned array contains four elements: key name 0, 1, key, and value. Unit 0 and key contain the key name of the array unit, and 1 and value contain data.If the internal pointer is out of the array range, this function returns false. */$ Sports =
Strstr ("Parent string", "sub-string") is used to locate the first occurrence of a sub-string in the parent string, and return the portion of the parent string from the start of the sub-string to the end of the parent string. For exampleEcho strstr (
1. When you use file_get_contents or fopen, file, readfile, and other functions to read a url, a variable named $ http_response_header is created to save the http response header, stream_get_meta_data can be used to obtain data streams opened by
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