<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: How to use variable variables in PHP</title>
	<atom:link href="http://www.onlineaspect.com/2009/05/31/how-to-use-variable-variables-in-php/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.onlineaspect.com/2009/05/31/how-to-use-variable-variables-in-php/</link>
	<description>a blog about building stuff on the web</description>
	<lastBuildDate>Fri, 05 Mar 2010 04:15:04 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Josh Fraser</title>
		<link>http://www.onlineaspect.com/2009/05/31/how-to-use-variable-variables-in-php/comment-page-1/#comment-755</link>
		<dc:creator>Josh Fraser</dc:creator>
		<pubDate>Wed, 18 Nov 2009 18:41:59 +0000</pubDate>
		<guid isPermaLink="false">http://www.onlineaspect.com/?p=255#comment-755</guid>
		<description>Try this &lt;a href=&quot;http://bit.ly/1eiBtw&quot; target=&quot;_blank&quot;&gt;http://bit.ly/1eiBtw&lt;/a&gt; </description>
		<content:encoded><![CDATA[<p>Try this <a href="http://bit.ly/1eiBtw" target="_blank">http://bit.ly/1eiBtw</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Josh Fraser</title>
		<link>http://www.onlineaspect.com/2009/05/31/how-to-use-variable-variables-in-php/comment-page-1/#comment-756</link>
		<dc:creator>Josh Fraser</dc:creator>
		<pubDate>Wed, 18 Nov 2009 18:41:59 +0000</pubDate>
		<guid isPermaLink="false">http://www.onlineaspect.com/?p=255#comment-756</guid>
		<description>Try this &lt;a href=&quot;http://bit.ly/1eiBtw&quot; target=&quot;_blank&quot;&gt;http://bit.ly/1eiBtw&lt;/a&gt; </description>
		<content:encoded><![CDATA[<p>Try this <a href="http://bit.ly/1eiBtw" target="_blank">http://bit.ly/1eiBtw</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: robert</title>
		<link>http://www.onlineaspect.com/2009/05/31/how-to-use-variable-variables-in-php/comment-page-1/#comment-754</link>
		<dc:creator>robert</dc:creator>
		<pubDate>Wed, 18 Nov 2009 16:08:03 +0000</pubDate>
		<guid isPermaLink="false">http://www.onlineaspect.com/?p=255#comment-754</guid>
		<description>I came to your post looking for an aswer for my PHP class assigment. Proffesor asked, 3.When is better to use a local variable? I can&#039;t seem to find an aswer for any. Any help will be great. </description>
		<content:encoded><![CDATA[<p>I came to your post looking for an aswer for my PHP class assigment. Proffesor asked, 3.When is better to use a local variable? I can&#039;t seem to find an aswer for any. Any help will be great.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Josh Fraser</title>
		<link>http://www.onlineaspect.com/2009/05/31/how-to-use-variable-variables-in-php/comment-page-1/#comment-686</link>
		<dc:creator>Josh Fraser</dc:creator>
		<pubDate>Thu, 03 Sep 2009 22:49:10 +0000</pubDate>
		<guid isPermaLink="false">http://www.onlineaspect.com/?p=255#comment-686</guid>
		<description>Yeah, the formatting is a bit wonky.  Sorry about that.  I use a service called IntenseDebate for my comments.   They give me a bunch of awesome features but it means I have to deal with a couple small issues like formatting and the inability to edit a comment.  Totally worth the trade-off if you ask me. </description>
		<content:encoded><![CDATA[<p>Yeah, the formatting is a bit wonky.  Sorry about that.  I use a service called IntenseDebate for my comments.   They give me a bunch of awesome features but it means I have to deal with a couple small issues like formatting and the inability to edit a comment.  Totally worth the trade-off if you ask me.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: fractalbit</title>
		<link>http://www.onlineaspect.com/2009/05/31/how-to-use-variable-variables-in-php/comment-page-1/#comment-679</link>
		<dc:creator>fractalbit</dc:creator>
		<pubDate>Wed, 02 Sep 2009 18:14:21 +0000</pubDate>
		<guid isPermaLink="false">http://www.onlineaspect.com/?p=255#comment-679</guid>
		<description>hmmm, it doesn&#039;t appear very well, it removed tabs and br actually appears as a new line instead of printing it. Is there a special tag i should use when posting code? (ex. {pre}code{/pre} )  
  
P.S. You added the ability to edit comments? :) (Or is it because i am now registered to intenseDebate?) </description>
		<content:encoded><![CDATA[<p>hmmm, it doesn&#39;t appear very well, it removed tabs and br actually appears as a new line instead of printing it. Is there a special tag i should use when posting code? (ex. {pre}code{/pre} )  </p>
<p>P.S. You added the ability to edit comments? <img src='http://www.onlineaspect.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  (Or is it because i am now registered to intenseDebate?)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: fractalbit</title>
		<link>http://www.onlineaspect.com/2009/05/31/how-to-use-variable-variables-in-php/comment-page-1/#comment-677</link>
		<dc:creator>fractalbit</dc:creator>
		<pubDate>Wed, 02 Sep 2009 11:10:50 +0000</pubDate>
		<guid isPermaLink="false">http://www.onlineaspect.com/?p=255#comment-677</guid>
		<description>hmmm, it doesn&#039;t appear very well, it removed tabs and br actually appears as a new line instead of printing it. Is there a special tag i should use when posting code? (ex. {pre}code{/pre} )  
 
P.S. You added the ability to edit comments? :) </description>
		<content:encoded><![CDATA[<p>hmmm, it doesn&#039;t appear very well, it removed tabs and br actually appears as a new line instead of printing it. Is there a special tag i should use when posting code? (ex. {pre}code{/pre} )  </p>
<p>P.S. You added the ability to edit comments? <img src='http://www.onlineaspect.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: fractalbit</title>
		<link>http://www.onlineaspect.com/2009/05/31/how-to-use-variable-variables-in-php/comment-page-1/#comment-676</link>
		<dc:creator>fractalbit</dc:creator>
		<pubDate>Wed, 02 Sep 2009 11:10:04 +0000</pubDate>
		<guid isPermaLink="false">http://www.onlineaspect.com/?p=255#comment-676</guid>
		<description>hmmm, it doesn&#039;t appear very well, it removed tabs and br actually appears as a new line instead of printing it. Is there a special tag i should use when posting comments? (ex. {pre}code{/pre} ) </description>
		<content:encoded><![CDATA[<p>hmmm, it doesn&#039;t appear very well, it removed tabs and br actually appears as a new line instead of printing it. Is there a special tag i should use when posting comments? (ex. {pre}code{/pre} )</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: fractalbit</title>
		<link>http://www.onlineaspect.com/2009/05/31/how-to-use-variable-variables-in-php/comment-page-1/#comment-678</link>
		<dc:creator>fractalbit</dc:creator>
		<pubDate>Wed, 02 Sep 2009 11:10:04 +0000</pubDate>
		<guid isPermaLink="false">http://www.onlineaspect.com/?p=255#comment-678</guid>
		<description>hmmm, it doesn&#039;t appear very well, it removed tabs and br actually appears as a new line instead of printing it. Is there a special tag i should use when posting comments? (ex. {pre}code{/pre} ) </description>
		<content:encoded><![CDATA[<p>hmmm, it doesn&#039;t appear very well, it removed tabs and br actually appears as a new line instead of printing it. Is there a special tag i should use when posting comments? (ex. {pre}code{/pre} )</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: fractalbit</title>
		<link>http://www.onlineaspect.com/2009/05/31/how-to-use-variable-variables-in-php/comment-page-1/#comment-675</link>
		<dc:creator>fractalbit</dc:creator>
		<pubDate>Wed, 02 Sep 2009 11:06:25 +0000</pubDate>
		<guid isPermaLink="false">http://www.onlineaspect.com/?p=255#comment-675</guid>
		<description>Thanks Josh, to understand it better i tried to reconstruct the function and improve on it. Here is what i ended up with: 
 
function debug($variables){ 
/* 
Enter the variable names you wish to debug as a string separated by commas 
It will print the variable name and their respective values like: $varname = value 
The variable values can be strings, integers, floats, arrays and possibly objects? (didn&#039;t test it) 
For example .... 
 
$thanks = &#039;to Josh Fraser&#039;; 
$fruits = array(&quot;apple&quot;, &quot;orange&quot;, &quot;cherry&quot;); 
debug(&quot;thanks, fruits&quot;); 
 
will print... 
 
------------------------------------------------------------------------ 
Debug info 
------------------------------------------------------------------------ 
$thanks = to Josh Fraser 
$fruits = Array ( [0] =&gt; apple [1] =&gt; orange [2] =&gt; cherry ) 
------------------------------------------------------------------------ 
*/ 
 
echo &#039;&lt;hr /&gt;Debug info&#039;; 
$var_array = explode(&quot;,&quot;, $variables); 
foreach($var_array as $var){ 
$var = trim($var); 
global $$var; 
$results[] = &#039;$&#039; . $var . &#039; = &#039; . print_r($$var, TRUE) . &#039;&lt;br /&gt;&#039;; 
} 
echo &#039;&lt;hr /&gt;&#039; . implode(&quot;&quot;, $results) . &#039;&lt;hr /&gt;&#039;; 
} </description>
		<content:encoded><![CDATA[<p>Thanks Josh, to understand it better i tried to reconstruct the function and improve on it. Here is what i ended up with: </p>
<p>function debug($variables){<br />
/*<br />
Enter the variable names you wish to debug as a string separated by commas<br />
It will print the variable name and their respective values like: $varname = value<br />
The variable values can be strings, integers, floats, arrays and possibly objects? (didn&#039;t test it)<br />
For example &#8230;. </p>
<p>$thanks = &#039;to Josh Fraser&#039;;<br />
$fruits = array(&quot;apple&quot;, &quot;orange&quot;, &quot;cherry&quot;);<br />
debug(&quot;thanks, fruits&quot;); </p>
<p>will print&#8230; </p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
Debug info<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
$thanks = to Josh Fraser<br />
$fruits = Array ( [0] =&gt; apple [1] =&gt; orange [2] =&gt; cherry )<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
*/ </p>
<p>echo &#039;&lt;hr /&gt;Debug info&#039;;<br />
$var_array = explode(&quot;,&quot;, $variables);<br />
foreach($var_array as $var){<br />
$var = trim($var);<br />
global $$var;<br />
$results[] = &#039;$&#039; . $var . &#039; = &#039; . print_r($$var, TRUE) . &#039;<br />&#039;;<br />
}<br />
echo &#039;&lt;hr /&gt;&#039; . implode(&quot;&quot;, $results) . &#039;&lt;hr /&gt;&#039;;<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Josh Fraser</title>
		<link>http://www.onlineaspect.com/2009/05/31/how-to-use-variable-variables-in-php/comment-page-1/#comment-667</link>
		<dc:creator>Josh Fraser</dc:creator>
		<pubDate>Mon, 31 Aug 2009 19:55:17 +0000</pubDate>
		<guid isPermaLink="false">http://www.onlineaspect.com/?p=255#comment-667</guid>
		<description>Yeah, that&#039;s actually a great example of how to use variable variables:  
  
function debug($var_name) {  
    global ${$var_name};  
    echo &quot;variable name: $var_name &#124; variable value:  &quot;.${$var_name};  
}  
  
$problem = &quot;solved!&quot;;  
debug(&quot;problem&quot;);  
  
A couple things to notice about this example.  1) You need to declare the variable as global because of the way name-spacing works in PHP and 2) you need to pass in the name of the variable (problem instead of $problem). </description>
		<content:encoded><![CDATA[<p>Yeah, that&#039;s actually a great example of how to use variable variables:  </p>
<p>function debug($var_name) {<br />
    global ${$var_name};<br />
    echo &quot;variable name: $var_name | variable value:  &quot;.${$var_name};<br />
}  </p>
<p>$problem = &quot;solved!&quot;;<br />
debug(&quot;problem&quot;);  </p>
<p>A couple things to notice about this example.  1) You need to declare the variable as global because of the way name-spacing works in PHP and 2) you need to pass in the name of the variable (problem instead of $problem).</p>
]]></content:encoded>
	</item>
</channel>
</rss>
