Difference between print_r() and var_dump()

print_r() and var_dump() spitting out a array.

print_r():- It displays information about a variable in a way that’s readable by humans. array values will be presented in a format that shows keys and elements.
example:-

<?php
$arr_name=array("John","Tony","Anna","Ruby");
print_r($arr_name);
?>
Output:- Array ( [0] => John [1] => Tony [2] => Anna [3] => Ruby )

var_dump:- It displays structured information about variables/expressions including its type and value.
example:-

<?php
$arr_name=array("John","Tony","Anna","Ruby");
var_dump($arr_name);
?>
Output:- array
0 => string ‘John’ (length=4)
1 => string ‘Tony’ (length=4)
2 => string ‘Anna’ (length=4)
3 => string ‘Ruby’ (length=4)