<?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>Patrick Galbraith &#187; Miscellaneous</title>
	<atom:link href="https://www.pjgalbraith.com/category/uncategorized/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.pjgalbraith.com</link>
	<description>Web developer - Adelaide, Australia</description>
	<lastBuildDate>Tue, 23 Mar 2021 02:57:48 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=4.1.42</generator>
	<item>
		<title>PHP Foreach Reference Gotcha</title>
		<link>https://www.pjgalbraith.com/php-foreach-reference-gotcha/</link>
		<comments>https://www.pjgalbraith.com/php-foreach-reference-gotcha/#comments</comments>
		<pubDate>Sat, 25 Oct 2014 12:27:03 +0000</pubDate>
		<dc:creator><![CDATA[Patrick]]></dc:creator>
				<category><![CDATA[Miscellaneous]]></category>

		<guid isPermaLink="false">http://www.pjgalbraith.com/?p=1036</guid>
		<description><![CDATA[ ]]></description>
				<content:encoded><![CDATA[<pre><code>$items = array(1, 2, 3);

foreach($items as &#038;$item) {
    echo $item;
}

// prints: 123

echo $item;

// prints: 3

foreach($items as $item) {
    echo $item;
}

// prints: 122
</code></pre>
<p>What?<br />
This happens because after the first loop <code>$item</code> maintains the reference to <code>3</code>.</p>
<p>Of course PHP does not have block scoping so we then assign that reference to the current loop item in the second loop overwriting the initial value.</p>
<p>The fix. Always unset the item after the closing brace.</p>
<pre><code>foreach($items as &#038;$item) {
    echo $item;
} unset($item);
</code></pre>
<p>Or put it in a self-invoking function.</p>
<pre><code>call_user_func(function() use (&#038;$items) {
    foreach($items as &#038;$item) {
        echo $item;
    }
});</code></pre>
]]></content:encoded>
			<wfw:commentRss>https://www.pjgalbraith.com/php-foreach-reference-gotcha/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>Windows 7 64bit Sharing Brother Fax Printer with Windows XP</title>
		<link>https://www.pjgalbraith.com/windows-7-64bit-sharing-brother-fax-printer-with-windows-xp/</link>
		<comments>https://www.pjgalbraith.com/windows-7-64bit-sharing-brother-fax-printer-with-windows-xp/#comments</comments>
		<pubDate>Tue, 12 Jul 2011 02:57:06 +0000</pubDate>
		<dc:creator><![CDATA[Patrick]]></dc:creator>
				<category><![CDATA[Miscellaneous]]></category>

		<guid isPermaLink="false">http://www.pjgalbraith.com/?p=142</guid>
		<description><![CDATA[The other day I had an issue with sharing a Brother Fax 2850 printer connected to Windows 7 with another Windows XP computer. Which I wanted to post for future reference. The problem is fairly simple the driver from the Brother website here has a slightly different model name to the one detected by Windows [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>The other day I had an issue with sharing a Brother Fax 2850 printer connected to Windows 7 with another Windows XP computer. Which I wanted to post for future reference.</p>
<p>The problem is fairly simple the driver from the Brother website <a href="http://welcome.solutions.brother.com/bsc/public/as/au/en/dlf/dlf/000000/001100/dlf001168.html?reg=as&amp;c=au&amp;lang=en&amp;prod=fax2850_as&amp;type2=1&amp;os=7&amp;flang=4&amp;dlid=dlf001168">here</a> has a slightly different model name to the one detected by Windows 7.</p>
<p>The fix is easy just extract the driver then open the brpry4p.inf file with notepad (you may need to change the files properties so it is no longer &#8220;read-only&#8221; in order to save). </p>
<p>Scroll down to this line:</p>
<p><code>;; Model Name<br />
BRFAX2900.MFC = "Brother FAX-2900"<br />
BRFAX3800.MFC = "Brother FAX-3800"<br />
BRFAX2850.MFC = "Brother FAX-2850" </code></p>
<p>Should be changed to the name Windows XP has listed:</p>
<p><code>;; Model Name<br />
BRFAX2900.MFC = "Brother FAX-2900"<br />
BRFAX3800.MFC = "Brother FAX-3800"<br />
BRFAX2850.MFC = "Brother FAX-2850 USB"</code></p>
<p>After that change Windows XP should correctly detect the driver.</p>
]]></content:encoded>
			<wfw:commentRss>https://www.pjgalbraith.com/windows-7-64bit-sharing-brother-fax-printer-with-windows-xp/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
