note 40228 deleted from ref.variables by nlopess
| From: | nlopess@php.net | Date: | Mon, 28 Jun 2004 14:27:45 +0000 |
| Subject: | note 40228 deleted from ref.variables by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-72013@lists.php.net to get a copy of this message | ||
Note Submitter: postings-php-manual@hans-spath.de
----
colored var_export:
<?
function my_var_export_hl( $mixed, $ret=false ) {
return highlight_string( '<? '.var_export($mixed,true), $ret );
} ?>
+ looks nice
+ HTML code in $mixed will be escaped correctly for output
- returned string is no valid php code, so don't use it in eval()
Example:
<? my_var_export_hl( array('key'=>NULL,
1=>array(false,"\xFF",'<i>')) ); ?>
Output (colored!):
<? array (
'key' => NULL,
1 =>
array (
0 => false,
1 => 'ÿ',
2 => '<i>',
),
)