<?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>Neanderthal Technology &#187; notice</title>
	<atom:link href="http://www.neanderthal-technology.com/tag/notice/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.neanderthal-technology.com</link>
	<description>by Pep</description>
	<lastBuildDate>Mon, 21 Nov 2011 18:41:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>PHP: Only variable references should be returned by reference</title>
		<link>http://www.neanderthal-technology.com/2009/04/php-only-variable-references-should-be-returned-by-reference/</link>
		<comments>http://www.neanderthal-technology.com/2009/04/php-only-variable-references-should-be-returned-by-reference/#comments</comments>
		<pubDate>Fri, 24 Apr 2009 08:22:10 +0000</pubDate>
		<dc:creator>Pep</dc:creator>
				<category><![CDATA[Computing]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Add new tag]]></category>
		<category><![CDATA[notice]]></category>
		<category><![CDATA[Only variable references should be returned by referenc]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.dopes-planet.net/?p=88</guid>
		<description><![CDATA[Take the following code example: This looks like valid code, right? PHP wants you to use the &#38; in both places to indicate that you want to return by reference, and that&#8217;s what we have. But how come that this code still generates the notice? Quote from php &#8220;return&#8221; manual (http://php.net/return): Note: You should never&#8230;]]></description>
			<content:encoded><![CDATA[<p>Take the following code example:</p>
<pre class="brush: php; title: ; notranslate">&lt;?php
class myClass {
	public $var = 1;

 	public function &amp;getVar() {
 		return($this-&gt;var);
        }
}

$obj = new myClass;
$value = &amp;$obj-&gt;getVar();
?&gt;</pre>
<p>This looks like valid code, right? PHP wants you to use the <em>&amp;</em> in both places to indicate that you want to return by reference, and that&#8217;s what we have. But how come that this code still generates the notice?</p>
<p>Quote from php &#8220;return&#8221; manual (http://php.net/return):</p>
<blockquote><p><strong>Note:</strong> You should never use parentheses around your return variable when returning by reference, as this will not work. You can only return variables by reference, not the result of a statement. If you use <em>return ($a);</em> then you&#8217;re not returning a variable, but the result of the expression <em>($a)</em> (which is, of course, the value of <em>$a</em>).</p></blockquote>
<p>While it&#8217;s a very simple mistake, it did take me while to figure this out.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.neanderthal-technology.com/2009/04/php-only-variable-references-should-be-returned-by-reference/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

