debugger
answered Jul 20 '21 00:00
print_r and echo both print in php but
echo
echo print only variable which are not included as array or object
echo 'Hello world';
will print Hello world
but if it is array then in echo it wont print full array .
$hello=array('xyz');
echo $hello;
print_r()
print_r will print the string , integer value or array , or object anything.
how print_r will react with string variable ?
$xy='hello world';
print_r($xy);
print_r will print hello world
how print_r will react with array ?
$xy=array('hello','world');
print_r($xy);
print_r will print array with its value
how print_r will react with object ?
$xy=new stdClass;
$xy->type='object';
print_r($xy);
print_r will print object with its value