echo is a PHP statement, print and print_r are functions, statements have no return value, and functions can have return values (even if they are useless)
print can only print out the values of simple type variables (such as int, string)
print_r can print out complex types The value of the variable (such as array, object)
echo -- Output one or more strings
Description
void echo ( string arg1 [, string ...] ) //The return value is empty
echo "Hello"," Friend";
print -- Output a string
Description
int print (string arg)//The return value is an integer
print "Hello 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 the variable.
bool print_r (mixed expression [, bool return] ) //The return value is Boolean, the parameter is of mix type, which can be a string, an integer, an array, or an object class. Print_r() displays easy-to-understand information about a variable. . If a string, integer or float is given, the variable value itself will be printed. If an array is given, the keys and elements will be displayed in a certain format. object is similar to an array.
print_r() will move the array pointer to the end.
You can
print_r(str);
print_r(int);
print_r(array);
print_r(obj);
You can also use var_dump var_export
The above introduces the difference between echo, print and print_r of powerpoint2007 official download? , including the official download of powerpoint2007, I hope it will be helpful to friends who are interested in PHP tutorials.