Re: var_dump()

From: Date: Tue, 23 Nov 2004 10:53:54 +0000
Subject: Re: var_dump()
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-15764@lists.php.net to get a copy of this message
Hi Lukas, > in the good all days (pre 1.0.0) all had to do was call > Var_Dump::display() but now the package uses classes instead of > directly specifying the style .. To dump a variable, nothing as changed : all you have to do is to call Var_Dump::display(), like in the good all days. The only thing that has changed is the way the styles are managed. Now, to use a different style (default : XHTML_Text), before calling Var_Dump::display() you have to initialize the default display mode, plus optional additional parameters (see each class for the full list), e.g. : Var_Dump::displayInit(array('display_mode' => 'XHTML_Table')); or Var_Dump::displayInit( array( 'display_mode' => 'XHTML_Table' ), array( 'show_eol' => '•', 'show_caption' => TRUE ) ); After that, each call to Var_Dump::display() uses the choosen renderer, with the specifyed options. To emulate the good all days (pre 1.0.0), all you have to do is to put the following line in the top of your code (or in auto_prepend file) : Var_Dump::displayInit(array('display_mode' => 'HTML4_Table')); You can also use the factory method to instanciate a Var_Dump object : $v = & Var_Dump::factory(array('display_mode' => 'HTML4_Table')); echo $v->toString($var); Regards, Frederic Poeydomenge

« previous php.pear.general (#15764) next »