PHP Code to Display an Array in HTML
Simply pass the array of your choice in place of $var and you will get a nice HTML print out.

<?
$var 
= Array('Test''foo' => 'bar', Array('dog'false));
print 
str_replace('<br&nbsp;/>''<br />'str_replace(' ''&nbsp;'nl2br(print_r($vartrue))));
?>

e.g.
Array
(
    [0] => Test
    [foo] => bar
    [1] => Array
        (
            [0] => dog
            [1] => 
        )

)


XHTML Valid Code Highlighting
Note: I did not write this code; it was posted in the PHP manual by someone else. I am merely reposting it.

PHP has a useful function called highlight_string that does just that. Unfortunately it is not XHTML compatible in PHP4 (it uses the font tag). Below is fix for those (including myself) still using PHP4.

<?
function xhtmlHighlightString($str$return=false)
{
   
$hlt highlight_string($strtrue);
   
$ret str_replace(
         array(
'<font color="''</font>'),
         array(
'<span style="color: ''</span>'),
         
$hlt);
   if(
$return)
         return 
$ret;
   echo 
$ret;
   return 
true;
}
?>


Objects within Objectss and Method Names
PHP handles objects within objects just fine normally, with $object1->object2->object2_method() executing successfully. If both classes define methods with the same name, you need to be careful that both objects are correctly initialized. For example:

<?
class class2
{
  public function 
query()
  {
  }
}
class 
class1
{
  private 
$class2;
  
  public 
__construct()
  {
    
$this->class2 = new class2();
  }

  public function 
query()
  {
    
$this->class2->query();
  }
}
?>