Introduction: This is a detailed page for differences between echo (), print (), and print_r () in PHP. It introduces the knowledge, skills, and experience related to PhP, and some PHP source code.
Class = 'pingjiaf' frameborder = '0' src = 'HTTP: // biancheng.dnbc?info/pingjia.php? Id = 339377 'rolling = 'no'>
ECHO is a PHP statement, print and print_r are functions, and the statement does not return values. The function can return values (even if it is not used)
Print () can only print values of simple type variables (such as int and string)
Print_r () can print values of complex types of variables (such as arrays and objects)
Echo outputs one or more strings
Echo -- output one or more strings
Descr resume ption
Void echo (string arg1 [, string...]) // The returned value is null.
Echo "hello", "friend ";
Print -- output a string
Descr resume ption
Int print (string Arg) // the return value is an integer.
Print "your good friend ";
You can perform the following operations:
$ Name = Print "nihao \ n ";
$ STR = 'test print value is $ name .';
Eval ("\ $ print = \" $ STR \";");
Echo $ print;
Print_r -- print easy-to-understand information about variables.
Bool print_r (mixed expression [, bool return]) // the return value is Boolean and the parameter type is mix. It can be a string, an integer, an array, and an object class print_r () displays easy-to-understand information about a variable. If the value is string, integer, or float, the variable value is printed. If array is provided, keys and elements are displayed in a certain format. Objects are similar to arrays.
Print_r () moves the array pointer to the last edge.
You can
Print_r (STR );
Print_r (INT );
Print_r (array );
Print_r (OBJ );
You can also use var_dump var_export.
Love J2EE follow Java Michael Jackson video station JSON online tools
Http://biancheng.dnbcw.info/php/339377.html pageno: 8.