<?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>Mon, 09 Jan 2012 18:55:04 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
	<item>
		<title>By: dmjones</title>
		<link>http://www.onlineaspect.com/2009/05/31/how-to-use-variable-variables-in-php/comment-page-1/#comment-4584</link>
		<dc:creator>dmjones</dc:creator>
		<pubDate>Tue, 20 Dec 2011 16:45:57 +0000</pubDate>
		<guid isPermaLink="false">http://www.onlineaspect.com/?p=255#comment-4584</guid>
		<description>The alternative was suggested and works well 
 
$this-&gt;{&#039;_&#039; . $key} = $val;   </description>
		<content:encoded><![CDATA[<p>The alternative was suggested and works well </p>
<p>$this-&gt;{&#039;_&#039; . $key} = $val;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: dmjones</title>
		<link>http://www.onlineaspect.com/2009/05/31/how-to-use-variable-variables-in-php/comment-page-1/#comment-4582</link>
		<dc:creator>dmjones</dc:creator>
		<pubDate>Tue, 20 Dec 2011 06:35:30 +0000</pubDate>
		<guid isPermaLink="false">http://www.onlineaspect.com/?p=255#comment-4582</guid>
		<description>I wanted to use this avenue in order to populate private variables of a class using an array as input.  However, the values don&#039;t seem to stay or aren&#039;t even assigned to the private vars.  Any ideas? 
 
class aClass { 
    private $_fruitA; 
    private $_fruitB; 
    private $_fruitC; 
 
    public function set($inputArray) 
    { 
        foreach ($inputArray as $key=&gt;$val) 
        { 
            $var = &quot;this-&gt;_{$key}&quot;; 
            $$var = $val; 
 
            //prints nothing 
            print &quot;this-&gt;_$key: &quot;.$this-&gt;_fruit.&quot;n&quot;; 
 
            //prints the $val assigned in $inputArray 
            print &quot;$$var: &quot;.$$var.&quot;nn&quot;;    
        } 
    } 
} 
 
$fruit = new aClass(); 
$fruit-&gt;set(array(&#039;fruitA&#039; =&gt; &#039;apple&#039;, &#039;fruitB&#039; =&gt; &#039;banana&#039;)); </description>
		<content:encoded><![CDATA[<p>I wanted to use this avenue in order to populate private variables of a class using an array as input.  However, the values don&#039;t seem to stay or aren&#039;t even assigned to the private vars.  Any ideas? </p>
<p>class aClass {<br />
    private $_fruitA;<br />
    private $_fruitB;<br />
    private $_fruitC; </p>
<p>    public function set($inputArray)<br />
    {<br />
        foreach ($inputArray as $key=&gt;$val)<br />
        {<br />
            $var = &quot;this-&gt;_{$key}&quot;;<br />
            $$var = $val; </p>
<p>            //prints nothing<br />
            print &quot;this-&gt;_$key: &quot;.$this-&gt;_fruit.&quot;n&quot;; </p>
<p>            //prints the $val assigned in $inputArray<br />
            print &quot;$$var: &quot;.$$var.&quot;nn&quot;;<br />
        }<br />
    }<br />
} </p>
<p>$fruit = new aClass();<br />
$fruit-&gt;set(array(&#039;fruitA&#039; =&gt; &#039;apple&#039;, &#039;fruitB&#039; =&gt; &#039;banana&#039;));</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Scat DVD</title>
		<link>http://www.onlineaspect.com/2009/05/31/how-to-use-variable-variables-in-php/comment-page-1/#comment-3254</link>
		<dc:creator>Scat DVD</dc:creator>
		<pubDate>Sun, 30 Oct 2011 17:20:05 +0000</pubDate>
		<guid isPermaLink="false">http://www.onlineaspect.com/?p=255#comment-3254</guid>
		<description>Variables are used for storing values, like text strings, numbers or arrays. When a variable is declared, it can be used over and over again in your script. thanks for sharing the informative post. 
 
 </description>
		<content:encoded><![CDATA[<p>Variables are used for storing values, like text strings, numbers or arrays. When a variable is declared, it can be used over and over again in your script. thanks for sharing the informative post.</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-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>
</channel>
</rss>

