0% found this document useful (0 votes)
71 views6 pages

Var - Dump and Print - R

This document discusses the PHP functions var_dump() and print_r() for displaying structured information about variables and arrays. Var_dump() shows the type and value of variables and explores arrays recursively with indented values. Print_r() displays array values in a human-readable format showing keys and elements. The document provides an example using an object to demonstrate the different output of print_r() and var_dump().
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
71 views6 pages

Var - Dump and Print - R

This document discusses the PHP functions var_dump() and print_r() for displaying structured information about variables and arrays. Var_dump() shows the type and value of variables and explores arrays recursively with indented values. Print_r() displays array values in a human-readable format showing keys and elements. The document provides an example using an object to demonstrate the different output of print_r() and var_dump().
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 6

VAR_DUMP() & PRINT_R() IN PHP ARRAYS

MUHAMMED MASHAHIL P
ASSISTANT PROFESSOR
CAS VAZHAKKAD
Var_dump
• The var_dump function displays structured
information about variables/expressions
• including its type and value.
• Arrays are explored recursively with values
indented to show structure.
• It also shows which array values and
object properties are references.
Print_r
• The print_r() 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.
• Similar notation is used for objects.
example
$obj = (object) array('qualitypoint', 'technologies', 'India');

print_r($obj) will display below output in the screen.


stdClass Object ( [0] => qualitypoint
[1] => technologies
[2] => India )
var_dump($obj) will display ,,,
object(stdClass)#1 (3) { [0]=> string(12) "qualitypoint"
[1]=> string(12) "technologies"
[2]=> string(5) "India" }
END

You might also like