PHP/XML/var dump
Displaying Type Information with var_dump()
<?
$testing = 5;
var_dump( $testing );
?>
Dump a multidimensional array
<?php
$objects=array("A" => array("Shape" => "Cylinder",
"Color" => "Red",
"Material" => "Metal"),
"B" => array("Shape" => "Rectangle",
"Color" => "White",
"Material" => "Paper"),
"C" => array("Shape" => "Sphere",
"Color" => "Red",
"Material" => "Fruit"),
"D" => array("Shape" => "Sphere",
"Color" => "Orange",
"Material" => "Fruit"),
"E" => array("Shape" => "Rectangle",
"Color" => "Yellow",
"Material" => "Paper"));
var_dump($objects);
?>
Functions Used for Debugging
Name Description
echo() Prints a simple variable or value
print() Prints a simple variable or value
printf() Prints a formatted string
var_dump() Prints the type and content of a variable
print_r() Recursively prints the content of an array or object
debug_backtrace() Returns an array with the call stack and other values
<?php
include "debug.inc";
$a = array("orange", "apple");
debug_print($a);
?>
<?php
include "debug1.inc";
$a = array("orange", "apple");
debug_print($a);
debug_print($a, __FILE__, __LINE__);
?>