Different between the var_dump() and print_r()?

Answer Posted / rubina

The difference between the two is:
Var_dump() returns the datatype also of the variable which
print_r() does not.

Eg:
$query="Select fname from table where id=20";
$result=mysql_query($query);
$row=mysql_fetch_row($result);

print_r($query);
o/p
---------------
SELECT fname FROM information where id=53

var_dump($query);
o/p
----------------
string(43) " SELECT fname FROM information where id=53"

Is This Answer Correct ?    7 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why is php so popular?

688


What are the differences between php3 and php4 and php5? What is the current stable version of php? What advance thing in php7?

799


What is use of header() function in php? What the limitation of header()?

700


What is the use of offset in mysql?

687


What is ci in php?

726


What is the function of string in c?

737


What is php static function?

720


Explain the installation of PHP on UNIX systems?

767


What is the difference between $name and $$name?

727


Why do we use csrf token?

672


What is php in simple words?

715


Explain how can we execute a php script using command line?

703


List some features of php that are deprecated in php7?

646


What is the use of mvc in php?

712


Which methods should be used for sending an email using the variables $to, $subject, and $body?

776