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

What is the purpose of pear in php?

588


How can we encrypt the password using php?

554


Is it possible to remove the html tags from data?

529


What is the use of namespace in php?

556


Tell me what does the php error 'parse error in php - unexpected t_variable at line x' means?

565






What is difference between web service and api?

516


Which framework is best for php development?

494


Is there an easy way to delete an element from a php array?

479


How many different types of messages available in php?

549


What is $this in php?

537


Which cryptographic extension provide generation and verification of digital signatures?

531


which will print out the php call stack?

590


How can you execute php script from the command line?

549


Which operator is used to concatenate two strings in PHP?

552


Is php better than python?

557