Today PHP introduce three common output statements:
1, echo statement
2, print_r statement
3, var_dump statement
echo statement: may output a number, string
Example:
echo 12 is;
echo 'aswedf';
echo '<P> This is a paragraph <p>';
run results:
12 is
aswedf
This is a paragraph
print_r statement: may output numbers, strings and arrays
Example:
print_r (123);
print_r ( 'rewsd');
print_r ([1,4,2,67,8]);
run results:
123
rewsd
the Array ([0] => 1 [1] => 4 [2] => 2 [3] => 67 [4] => 8)
var_dump statement: may be any type of output, and the detailed information display of data, the more test
var_dump (to true);
var_dump (to false);
var_dump ([1,4,2,67,8]);
class A {}
$ obj = new new A;
var_dump ($ obj);
var_dump (null);
run results:
BOOL (to true)
BOOL (to false)
Array (. 5) {[0] => int (. 1) [. 1] => int (. 4) [2] => int (2) [. 3] => int (67) [. 4] => int (. 8)}
Object (A). 1 # (0)} {
NULL