PHP/XML/var dump

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

Displaying Type Information with var_dump()

   <source lang="html4strict">

<? $testing = 5; var_dump( $testing ); ?>

 </source>
   
  


Dump a multidimensional array

   <source lang="html4strict">

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

 </source>
   
  


Functions Used for Debugging

   <source lang="html4strict">

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

 </source>