PHP/XML/var dump — различия между версиями

Материал из Web эксперт
Перейти к: навигация, поиск
м (1 версия)
 
(нет различий)

Версия 10:37, 26 мая 2010

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__);
?>