arrays - php var_dump() vs print_r() -
What's the difference between var_dump ()
and print_r ()
In the case of excluding an array in the form of a string?
var_dump
function displays type and Structured information about variables / expressions including value Sorted values are detected with the values indented to show the structure. It also shows which array values and object properties are references.
print_r ()
displays information about a variable that is readable by humans. The array values will be presented in a format that represents keys and elements . Similar notation is used for the object.
Example:
$ obj = (object) array ('Quality point', 'technique', 'India');
var_dump ($ obj)
will display the output below the screen.
object (stdClass) # 1 (3) {[0] = & gt; String (12) "Quality Point" [1] = & gt; String (12) "Techniques" [2] = & gt; The string will be displayed below the output in the string (5) "India"}
and, print_r ($ obj)
screen.
StdClass object ([0] = & gt; Quality point [1] => Technology [2] => India)
More info
Comments
Post a Comment