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

How can you retrieve a cookie value?

539


What is difference between variable declaration and variable definition?

499


How does php isset work?

530


What is a controller php?

504


What is the interface in php?

534






i m a B.E,passed out few yrs bak failed to find good job due to less marks now thinkin of a career as PHP developer. is it a lucarative field and wat r career prospects; hv heard dat initial salary is very less bout 6k also most jobs r contrct jobs.pls guide me need ur valuable advice.pls hellppp!! thnx..

1673


What is cookie in php with example?

523


What is put method in php?

528


Explain Whitespace Characters?

581


What is the function of string in c?

524


How to download file in php?

551


What are the advantages of stored procedures, triggers, indexes in php?

500


Explain about the connective abilities of the PHP?

598


How can I increase my website session?

536


How to check if a string contains a character or word in php?

538