<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Joseph Scott &#187; html_var_dump</title>
	<atom:link href="http://josephscott.org/archives/tag/html_var_dump/feed/" rel="self" type="application/rss+xml" />
	<link>http://josephscott.org</link>
	<description></description>
	<lastBuildDate>Mon, 06 Sep 2010 17:44:45 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
	<atom:link rel='hub' href='http://josephscott.org/?pushpress=hub'/>
		<item>
		<title>PHP Helpers: html_var_dump</title>
		<link>http://josephscott.org/archives/2010/02/php-helpers-html_var_dump/</link>
		<comments>http://josephscott.org/archives/2010/02/php-helpers-html_var_dump/#comments</comments>
		<pubDate>Fri, 05 Feb 2010 16:29:46 +0000</pubDate>
		<dc:creator>Joseph Scott</dc:creator>
				<category><![CDATA[Posts]]></category>
		<category><![CDATA[html_var_dump]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[php-helpers]]></category>

		<guid isPermaLink="false">http://josephscott.org/?p=1862</guid>
		<description><![CDATA[With the last function being html_print_r this next one should come as no suprise, html_var_dump: if ( !function_exists( 'html_var_dump' ) ) { function html_var_dump( $data ) { $out = &#34;\n&#60;pre class='html-var-dump'&#34;; $out .= &#34; style='border: 1px solid #ccc; padding: 7px;'&#62;\n&#34;; &#8230; <a href="http://josephscott.org/archives/2010/02/php-helpers-html_var_dump/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>With the last function being <a href="http://josephscott.org/archives/2010/02/php-helpers-html_print_r/">html_print_r</a> this next one should come as no suprise, <code>html_var_dump</code>:</p>
<pre class="brush: php;">
if ( !function_exists( 'html_var_dump' ) ) {
    function html_var_dump( $data ) {
        $out = &quot;\n&lt;pre class='html-var-dump'&quot;;
        $out .= &quot; style='border: 1px solid #ccc; padding: 7px;'&gt;\n&quot;;

        ob_start( );
        var_dump( $data );
        $out .= esc_html( ob_get_contents( ) );
        ob_end_clean( );

        $out .= &quot;\n&lt;/pre&gt;\n&quot;;

        return $out;
    }
}
</pre>
<p>Even though I tend to use print_r more often than <a href="http://us.php.net/var_dump">var_dump</a>, there are times where the type data that var_dump provides can be very helpful.  Unfortunately var_dump will always display data, so it needed to be wrapped in a few <a href="http://us.php.net/manual/en/ref.outcontrol.php">output control functions</a> ( ob_start, ob_get_contents, and ob_end_clean ) to capture it.</p>
]]></content:encoded>
			<wfw:commentRss>http://josephscott.org/archives/2010/02/php-helpers-html_var_dump/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
