<?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>nerd. &#187; PHP</title>
	<atom:link href="http://nerd.steveferson.com/category/web/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://nerd.steveferson.com</link>
	<description>One nerd's struggle against the beast that is technology</description>
	<lastBuildDate>Tue, 10 Jan 2012 13:15:45 +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>Big PHP Niggle</title>
		<link>http://nerd.steveferson.com/2008/06/20/big-php-niggle/</link>
		<comments>http://nerd.steveferson.com/2008/06/20/big-php-niggle/#comments</comments>
		<pubDate>Fri, 20 Jun 2008 16:31:53 +0000</pubDate>
		<dc:creator>nerd.</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Niggles]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Web Design]]></category>
		<category><![CDATA[web development]]></category>

		<guid isPermaLink="false">http://nerd.steveferson.com/?p=85</guid>
		<description><![CDATA[I need a quick bitch. I love PHP. It&#8217;s everywhere. All my sites are written in it. My CMS is written in it. My blog engines, WordPress and b2evolution, are written in it. It&#8217;s free. It runs on any platform. Hosts all support it. With PHP 5 they&#8217;ve even done a lot of work on [...]]]></description>
			<content:encoded><![CDATA[<p>I need a quick bitch.</p>
<p>I love <a title="PHP: Hypertext Preprocessor" href="http://www.php.net/">PHP</a>. It&#8217;s everywhere. All my sites are written in it. My CMS is written in it. My blog engines, <a title="WordPress › Blog Tool and Weblog Platform" href="http://www.wordpress.org/">WordPress</a> and <a title="b2evolution: More than a blog! — Blog+Photo+CMS software" href="http://b2evolution.net/">b2evolution</a>, are written in it. It&#8217;s free. It runs on any platform. Hosts all support it. With PHP 5 they&#8217;ve even done a lot of work on PHP4&#8242;s main downfall &#8211; lack of OOP support.</p>
<p>One thing really pisses me off though &#8211; it&#8217;s totally inconsistent.  Consider these two functions:</p>
<ol>
<li><a title="PHP: strstr - Manual" href="http://uk.php.net/manual/en/function.strstr.php">strstr</a> — Find first occurrence of a string</li>
<li><a title="PHP: in_array - Manual" href="http://uk.php.net/manual/en/function.in-array.php">in_array</a> — Checks if a value exists in an array</li>
</ol>
<p>Take a close look. See the signatures?</p>
<p><code> string strstr  ( string $haystack  , mixed $needle  [, bool $before_needle  ] )</code><br />
<code> bool in_array  ( mixed $needle  , array $haystack  [, bool $strict  ] )</code></p>
<p>In in_array the first parameter is what you&#8217;re looking for and the second is what you&#8217;re looking in (more or less consistent with <a title="PHP: preg_match - Manual" href="http://uk.php.net/manual/en/function.preg-match.php">preg_match</a>).  In strstr (and its derivatives) this order is reversed. Who on Earth let that slip through? I&#8217;m yet to find a free text editor that will tell you which parameters a given function expects (Dreamweaver does a decent job but it&#8217;s bloody expensive for a text editor!) the way Visual Studio does for C#, which I use a lot in work.  Given that situation, you&#8217;d expect consistency in this sort of thing.  Apparently not so. Instead, every time I want to use one of these functions I have to do a quick Google to bring me to the PHP manual page to tell me which order the parameters come in.</p>
<p>Of course they can&#8217;t even fix that without breaking backwards compatibility either, so we&#8217;re probably stuck with it.  Bloody marvellous!</p>
]]></content:encoded>
			<wfw:commentRss>http://nerd.steveferson.com/2008/06/20/big-php-niggle/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Solved: New WAMP Install Won&#8217;t Parse PHP</title>
		<link>http://nerd.steveferson.com/2008/05/07/solved-new-wamp-install-wont-parse-php/</link>
		<comments>http://nerd.steveferson.com/2008/05/07/solved-new-wamp-install-wont-parse-php/#comments</comments>
		<pubDate>Wed, 07 May 2008 21:50:10 +0000</pubDate>
		<dc:creator>nerd.</dc:creator>
				<category><![CDATA[Open Source]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Web Servers]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[wamp]]></category>
		<category><![CDATA[wamp server]]></category>

		<guid isPermaLink="false">http://nerd.steveferson.com/?p=75</guid>
		<description><![CDATA[I spent ages trying to figure out why my new installation of WAMP Server 2 wouldn&#8217;t parse my PHP and was spitting it out exactly as-is in the source file. I hoked around in the VirtualHost configuration, because the PHPMyAdmin that comes with WAMP Server was working fine so it had to be something wrong [...]]]></description>
			<content:encoded><![CDATA[<p>I spent ages trying to figure out why my new installation of <a title="Wamp Server - Windows, Apache, MySQL, PHP" href="http://www.wampserver.com/">WAMP Server 2</a> wouldn&#8217;t parse my <a title="PHP: Hypertext Preprocessor" href="http://www.php.net/">PHP </a>and was spitting it out exactly as-is in the source file. I hoked around in the VirtualHost configuration, because the <a title="phpMyAdmin - MySQL Database Administration Tool" href="http://www.phpmyadmin.net/">PHPMyAdmin</a> that comes with WAMP Server was working fine so it had to be something wrong in the VirtualHost that <em>I</em> just configured that was stopping .php files being sent to the PHP parser, yes? No.</p>
<p>As it turns out, it&#8217;s <a title="browser trying to download php files - WAMP Server Forums" href="http://www.wampserver.com/phorum/read.php?2,29910,29983,quote=1">much simpler than that</a>.  Apache <em>was </em>sending the file to PHP to be parsed, but PHP was ignoring my code.  Why? WAMP Server 2 comes with &#8220;<a title="PHP: Description of core php.ini directives" href="http://uk3.php.net/ini.core">short open tags</a>&#8221; turned off (this may be a general PHP or PHP 5 thing, though not sure).  Click WAMP -&gt; PHP -&gt; php.ini to edit the aforementioned file and find the line:</p>
<blockquote><p><code>short_open_tag = Off</code></p></blockquote>
<p>Replace <code>Off</code> with <code>On</code> et voila.</p>
<p>The &#8216;more correct&#8217; though long-winded solution is to replace all your <code>&lt;?</code> opening tags with <code>&lt;?php</code> if you&#8217;re really keen (though that&#8217;ll also mean replacing <code>&lt;?=</code> with <code>&lt;? echo</code>).  Me, I think I like my short tags.</p>
]]></content:encoded>
			<wfw:commentRss>http://nerd.steveferson.com/2008/05/07/solved-new-wamp-install-wont-parse-php/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>

