That is caused by improper use of your function. The print_r function has two parameters , The first parameter is required and is the variable to be printed. For example, "test" (string), 123 (integer), 123.01 (floating point), true (Boolean), etc.; The second parameter is optional and is a Boolean value. If true, it is not printed, but its output is returned as the result.
print_r does not output information but returns information when the second parameter is true. Your second parameter is a non-empty array and will be implicitly converted to true. If it is an empty array, it will be implicitly converted to false.
That is caused by improper use of your function.
The print_r function has two parameters ,
The first parameter is required and is the variable to be printed. For example, "test" (string), 123 (integer), 123.01 (floating point), true (Boolean), etc.;
The second parameter is optional and is a Boolean value. If true, it is not printed, but its output is returned as the result.
After running, the results are as follows:
In short, var_dump prints multiple sets of variable information, print_r prints a set of variable information
http://php.net/manual/en/func...
See the manual
print_r($var1,$var2); When $var2 is true, no output will be output; but if your second parameter is an array, will no error be reported? ?
The second parameter of print_r is of bool type, your usage is wrong.
print_r does not output information but returns information when the second parameter is true. Your second parameter is a non-empty array and will be implicitly converted to true. If it is an empty array, it will be implicitly converted to false.