PHP manual Preg_replace_callback Function Example 3
Output
What's going on with this $input? Is_array ($input) is not an array why would I output the following HTML format? Furthermore, the HTTP status code of the browser Firebug appears aborted after the IF (Is_array ($input)) statement is removed.
What are the $limit and & $count in an expression? Baidu less than? No case, not very clear after the test
Reply to discussion (solution)
Before asking, there should be no doubt
if (Is_array ($input)) {//If $input is an array
$input = ". $input [1]."; The $input is processed into a string
}
After the question, the manual has been made clear
Limit
The maximum number of replaceable times per pattern used for each subject string. The default is-1 (No limit).
Count
If specified, this variable is populated with the number of times the substitution is performed.
Number of records replaced
Before asking, there should be no doubt
if (Is_array ($input)) {//If $input is an array
$input = ". $input [1]."; The $input is processed into a string
}
After the question, the manual has been made clear
Limit
The maximum number of replaceable times per pattern used for each subject string. The default is-1 (No limit).
Count
If specified, this variable is populated with the number of times the substitution is performed.
Number of records replaced
But $input = "plain [indent] deep [indent] deeper [/indent] deep [/indent] plain"; not an array of arrays, why you can also output strings
Return Preg_replace_callback ($regex, ' parsetagsrecursive ', $input);
In this statement, $input should not be a string?
Return Preg_replace_callback ($regex, ' parsetagsrecursive ', $input);
In this statement, $input should not be a string?
I mean, I'm saying,
if (Is_array ($input)) {
$input = ". $input [1].";
}
$input is not an array of arrays, why is it possible to output $input = '. $input [1]. This format
$input = ". $input [1].";
It's a value assignment!
is to turn $input from an array into a string
Thank you, understand. $input is exactly the same in recursion.