1 string segmentation -- split () and preg_split () functions
Split-use a regular expression to split a string into an array -- it seems that PHP5.3 and above are not supported
Array split (string $ pattern, string $ string [, int $ limit])
Preg_split-use a regular expression to separate strings
Array preg_split (string $ pattern, string $ subject [, int $ limit =-1 [, int $ flags = 0])
Similarities: use regular expressions to separate strings.
Split () is easier to use. for example, to split "15:48:12", split can be written like this (['-:']).
To make preg_split () more complex, you have to write preg_split ("/[\ s-:]/").
The reason is: split () only supports POSIX regular expressions, while preg_split only supports Perl regular expressions.
POSIX is simpler than Perl, but it is not binary secure
By the way, there is an explode (), which is different from the above two functions. it uses strings to separate strings.
Array explode (string $ delimiter, string $ string [, int $ limit])
Use one string to separate another string
Note: There are many binary security explanations on the internet. I feel that the following explanation is helpful for understanding the above sentence:
Binary security functions only focus on binary strings and do not care about the specific format of strings. they only strictly access binary data and do not parse data in a special format.
2 What is the difference between mysqli: fetch_array and mysqli: fetch_row?
Mysqli_result: fetch_row ()
Retrieve a row from the result set as an enumerated array
Mixed mysqli_result: fetch_array ([int $ resulttype = MYSQLI_BOTH])
Get a row from the result set as an associated array or number array, or both
The manual says there seems to be no major difference between the two. The former is the enhanced version of the latter.
3 Single quotes and double quotes
Php two string types, single quotes and double quotation marks.
The single quotation mark string is a plain text (real text), which is directly sent to the browser without modification, whether it is a variable name or any other text.
Double quotation mark string. php will try to calculate the double quotation mark string, and the variable name will be replaced by the variable value.
Here, the concepts of variables, strings, text, and raw data cannot be confused:
A variable is a data symbol. a variable is represented by a variable name, indicating a data symbol.
The single quotation mark string is text, and itself (the literal value) is the original data.
The key is to understand the differences between text and variables. text is data, and variables are data symbols.
Let's take a look at the introduction of strings on the 4th page of the Chinese version of PHP and MySQL Web Development (formerly known as MySQL 12th.
Page 4th of the Chinese version of PHP and MySQL Web Development (formerly known as MySQL 12th), by Luke Welling & Laura Thomson
Php binary string meaning http://www.lofter.com/postentry? From = search & permalink = 139418_34c583
Zhihu: What does binary security mean? Http://www.zhihu.com/question/28705562
Success ., Fetch double quotation mark 1 string split () function and preg_split () function split use a regular expression to split the string...