<?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>the fancy part of the web &#187; php</title>
	<atom:link href="http://blog.tolleiv.de/tag/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.tolleiv.de</link>
	<description>is elsewhere - this is just about all sorts of web related work with a small factor of fanciness</description>
	<lastBuildDate>Fri, 03 Sep 2010 15:52:14 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>multiple arguments for mocked functions&#8230;.</title>
		<link>http://blog.tolleiv.de/2009/08/multiple-arguments-for-mocked-functions/</link>
		<comments>http://blog.tolleiv.de/2009/08/multiple-arguments-for-mocked-functions/#comments</comments>
		<pubDate>Mon, 17 Aug 2009 21:38:45 +0000</pubDate>
		<dc:creator>tolleiv</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[phpunit]]></category>

		<guid isPermaLink="false">http://blog.tolleiv.de/?p=221</guid>
		<description><![CDATA[If you look into the PHPUnit documentation ( http://www [...]]]></description>
			<content:encoded><![CDATA[<p>If you look into the PHPUnit documentation (<a href="http://www.phpunit.de/manual/3.3/en/test-doubles.html#test-doubles.mock-objects"> http://www.phpunit.de/manual/3.3/en/test-doubles.html#test-doubles.mock-objects</a> ) you&#8217;ll see some nice examples but non of them shows how to translate a function with multiple arguments into a mock-assumption.</p>
<p>Within the examples you&#8217;ll find:<br />
<code>$observer-&gt;expects($this-&gt;once())-&gt;method('update')<br/>-&gt;with($this-&gt;equalTo('something'));<br />
</code></p>
<p>So what if the &#8220;update&#8221; function has two arguments, pretty easy:<br />
<code>$observer-&gt;expects($this-&gt;once())-&gt;method('update')<br/>-&gt;with($this-&gt;equalTo('something'), $this-&gt;equalTo('something else'));<br />
</code></p>
<p>I guess Sebastian though that that there&#8217;s no need for documentation if something is so obvious <img src='http://blog.tolleiv.de/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> </p>
 <p>Feel free to Flattr this post at <a href="http://flattr.com/" title="Flattr" target="_blank">flattr.com</a>, if you like it.</p> <p><a href="http://flattr.com/" title="Flattr" target="_blank"><img src="http://blog.tolleiv.de/wp-content/plugins/flattrss/button-compact-static-100x17.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.tolleiv.de/2009/08/multiple-arguments-for-mocked-functions/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>www.encodechain.com</title>
		<link>http://blog.tolleiv.de/2009/08/www-encodechain-com/</link>
		<comments>http://blog.tolleiv.de/2009/08/www-encodechain-com/#comments</comments>
		<pubDate>Sat, 08 Aug 2009 12:54:13 +0000</pubDate>
		<dc:creator>tolleiv</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[encodingchain]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://blog.tolleiv.de/?p=213</guid>
		<description><![CDATA[I just "released" encodechain.com. A little tool which  [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://blog.tolleiv.de/wp-content/uploads/2009/08/encodingchain-0.1.png" rel="lightbox[213]"><img class="alignright size-medium wp-image-214" title="encodingchain-0.1" src="http://blog.tolleiv.de/wp-content/uploads/2009/08/encodingchain-0.1-300x221.png" alt="encodingchain-0.1" width="300" height="221" /></a>I just &#8220;released&#8221; <a href="http://www.encodechain.com" target="_blank">encodechain.com</a>. A little tool which enables to combine various popular PHP conversion methods and to check how they affect your input&#8230; feel free to give me some feedback <img src='http://blog.tolleiv.de/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>I&#8217;m also not sure whether I choose the right name for it &#8230; O_o</p>
<script type="text/javascript">
var flattr_wp_ver = '0.9.14';
var flattr_uid = '23199';
var flattr_url = 'http://blog.tolleiv.de';
var flattr_lng = 'en_GB';
var flattr_cat = 'text';
var flattr_tag = 'blog,wordpress,rss,feed';
var flattr_btn = 'large';
var flattr_tle = 'the fancy part of the web';
var flattr_dsc = 'is elsewhere - this is just about all sorts of web related work with a small factor of fanciness';
</script>
<script src="https://api.flattr.com/js/0.5.0/load.js?mode=auto" type="text/javascript"></script> <p>Feel free to Flattr this post at <a href="http://flattr.com/" title="Flattr" target="_blank">flattr.com</a>, if you like it.</p> <p><a href="http://flattr.com/" title="Flattr" target="_blank"><img src="http://blog.tolleiv.de/wp-content/plugins/flattrss/button-compact-static-100x17.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.tolleiv.de/2009/08/www-encodechain-com/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP Best practice comparison</title>
		<link>http://blog.tolleiv.de/2009/05/php-best-practice-comparison/</link>
		<comments>http://blog.tolleiv.de/2009/05/php-best-practice-comparison/#comments</comments>
		<pubDate>Thu, 28 May 2009 10:13:09 +0000</pubDate>
		<dc:creator>tolleiv</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://blog.tolleiv.de/?p=95</guid>
		<description><![CDATA[If you're still wondering whether the single- or double [...]]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;re still wondering whether the single- or double quotes are processed faster in PHP you might want to look at <a href="http://www.phpbench.com/" target="_blank">phpbench.com</a>. They don&#8217;t provide any ground breaking new insights, but they show in a very nice way what&#8217;s best pratice when it comes to arrays, strings and loops&#8230;</p>
 <p>Feel free to Flattr this post at <a href="http://flattr.com/" title="Flattr" target="_blank">flattr.com</a>, if you like it.</p> <p><a href="http://flattr.com/" title="Flattr" target="_blank"><img src="http://blog.tolleiv.de/wp-content/plugins/flattrss/button-compact-static-100x17.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.tolleiv.de/2009/05/php-best-practice-comparison/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Iterator [GoF]</title>
		<link>http://blog.tolleiv.de/2008/07/iterator-gof/</link>
		<comments>http://blog.tolleiv.de/2008/07/iterator-gof/#comments</comments>
		<pubDate>Mon, 07 Jul 2008 17:30:00 +0000</pubDate>
		<dc:creator>tolleiv</dc:creator>
				<category><![CDATA[behavioral]]></category>
		<category><![CDATA[iterator]]></category>
		<category><![CDATA[pattern]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[spl]]></category>

		<guid isPermaLink="false">http://blog.tolleiv.de/2008/07/iterator-gof/</guid>
		<description><![CDATA[Lot's of people like to write down things into lists, s [...]]]></description>
			<content:encoded><![CDATA[<p>Lot&#8217;s of people like to write down things into lists, so that they can go through that list later and check whether everything was fine. Normally every recipe has a list ~ there&#8217;s always a list of ingredients at the beginning of the recipe.<br />
This short example shows how such a list can be processed in PHP. So why would you want to have something else than a array to hold your objects? &#8211; My example still uses a array to hold the objects (uni- or bidirectional lists would also be possible) but it adds a kind of a facade to the array so that the common managements-tasks are handled within the List-Object. Everything you need for this example is present in PHP since version 5.0. The basic steps you need to do is to provide a <span style="font-style: italic;">&#8220;Object&#8221;</span> and an <span style="font-style: italic;">&#8220;ObjectList&#8221; </span>which implements the native <a href="http://www.php.net/manual/en/language.oop5.iterations.php"><span style="font-style: italic;">&#8220;Iterator&#8221;</span></a> interface and then you&#8217;re able to have very handy lists <img src='http://blog.tolleiv.de/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
<a onclick="document.getElementById('codeblockIt1').style.display=((document.getElementById('codeblockIt1').style.display=='block')?'none':'block');" href="#codeIt1"></a></p>
<div id="codeblockIt1" class="code">
<p><span style="color: #007700;">class </span><span style="color: #0000bb;">Incredient </span><span style="color: #007700;">{</span></p>
<p>public <span style="color: #0000bb;">$name</span><span style="color: #007700;">,</span><span style="color: #0000bb;">$amount</span><span style="color: #007700;">;<br />
public function </span><span style="color: #0000bb;">__construct</span><span style="color: #007700;">(</span><span style="color: #0000bb;">$name</span><span style="color: #007700;">,</span><span style="color: #0000bb;">$amount</span><span style="color: #007700;">) {<br />
</span><span style="color: #0000bb;">$this</span><span style="color: #007700;">-&gt;</span><span style="color: #0000bb;">name </span><span style="color: #007700;">= </span><span style="color: #0000bb;">$name</span><span style="color: #007700;">;<br />
</span><span style="color: #0000bb;">$this</span><span style="color: #007700;">-&gt;</span><span style="color: #0000bb;">amount </span><span style="color: #007700;">= </span><span style="color: #0000bb;">$amount</span><span style="color: #007700;">;<br />
}<br />
}</span></p>
<p>class <span style="color: #0000bb;">Recipe </span><span style="color: #007700;">implements </span><span style="color: #0000bb;">Iterator </span><span style="color: #007700;">{<br />
public </span><span style="color: #0000bb;">$title</span><span style="color: #007700;">;<br />
private </span><span style="color: #0000bb;">$ingredients</span><span style="color: #007700;">;</span></p>
<p>public function <span style="color: #0000bb;">__construct </span><span style="color: #007700;">(</span><span style="color: #0000bb;">$title</span><span style="color: #007700;">) {<br />
</span><span style="color: #0000bb;">$this</span><span style="color: #007700;">-&gt;</span><span style="color: #0000bb;">title </span><span style="color: #007700;">= </span><span style="color: #0000bb;">$title</span><span style="color: #007700;">;<br />
}</span></p>
<p>public function <span style="color: #0000bb;">addIncredient</span><span style="color: #007700;">(</span><span style="color: #0000bb;">Incredient $in</span><span style="color: #007700;">) {<br />
</span><span style="color: #0000bb;">$this</span><span style="color: #007700;">-&gt;</span><span style="color: #0000bb;">ingredients</span><span style="color: #007700;">[] = </span><span style="color: #0000bb;">$in</span><span style="color: #007700;">;<br />
}</span></p>
<p>public function <span style="color: #0000bb;">current </span><span style="color: #007700;">()  {   return </span><span style="color: #0000bb;">current </span><span style="color: #007700;">(</span><span style="color: #0000bb;">$this</span><span style="color: #007700;">-&gt;</span><span style="color: #0000bb;">ingredients</span><span style="color: #007700;">);    }<br />
public function </span><span style="color: #0000bb;">key </span><span style="color: #007700;">()      {   return </span><span style="color: #0000bb;">key</span><span style="color: #007700;">(</span><span style="color: #0000bb;">$this</span><span style="color: #007700;">-&gt;</span><span style="color: #0000bb;">ingredients</span><span style="color: #007700;">);         }<br />
public function </span><span style="color: #0000bb;">valid </span><span style="color: #007700;">()    {   return </span><span style="color: #0000bb;">current </span><span style="color: #007700;">(</span><span style="color: #0000bb;">$this</span><span style="color: #007700;">-&gt;</span><span style="color: #0000bb;">ingredients</span><span style="color: #007700;">);    }<br />
public function </span><span style="color: #0000bb;">rewind </span><span style="color: #007700;">()   {   return </span><span style="color: #0000bb;">reset </span><span style="color: #007700;">(</span><span style="color: #0000bb;">$this</span><span style="color: #007700;">-&gt;</span><span style="color: #0000bb;">ingredients</span><span style="color: #007700;">);      }<br />
public function </span><span style="color: #0000bb;">next </span><span style="color: #007700;">()     {   return </span><span style="color: #0000bb;">next </span><span style="color: #007700;">(</span><span style="color: #0000bb;">$this</span><span style="color: #007700;">-&gt;</span><span style="color: #0000bb;">ingredients</span><span style="color: #007700;">);       }<br />
}</span></p>
<p><!-- Code end --></p>
</div>
<div id="codeblockIt2" class="code" style="display: block;">
<p><span style="color: #0000bb;">$cookieRecipe </span><span style="color: #007700;">= new </span><span style="color: #0000bb;">Recipe</span><span style="color: #007700;">(</span><span style="color: #dd0000;">&#8220;Chocolate Cookie&#8221;</span><span style="color: #007700;">);<br />
</span><span style="color: #0000bb;">$cookieRecipe</span><span style="color: #007700;">-&gt;</span><span style="color: #0000bb;">addIncredient</span><span style="color: #007700;">(new </span><span style="color: #0000bb;">Incredient</span><span style="color: #007700;">(</span><span style="color: #dd0000;">&#8216;Flour&#8217;</span><span style="color: #007700;">,</span><span style="color: #dd0000;">&#8217;2.5 cups&#8217;</span><span style="color: #007700;">));<br />
</span><span style="color: #0000bb;">$cookieRecipe</span><span style="color: #007700;">-&gt;</span><span style="color: #0000bb;">addIncredient</span><span style="color: #007700;">(new </span><span style="color: #0000bb;">Incredient</span><span style="color: #007700;">(</span><span style="color: #dd0000;">&#8216;Baking soda&#8217;</span><span style="color: #007700;">,</span><span style="color: #dd0000;">&#8217;1 teaspoon&#8217;</span><span style="color: #007700;">));<br />
</span><span style="color: #0000bb;">$cookieRecipe</span><span style="color: #007700;">-&gt;</span><span style="color: #0000bb;">addIncredient</span><span style="color: #007700;">(new </span><span style="color: #0000bb;">Incredient</span><span style="color: #007700;">(</span><span style="color: #dd0000;">&#8216;Salt&#8217;</span><span style="color: #007700;">,</span><span style="color: #dd0000;">&#8217;0.5 teaspoon&#8217;</span><span style="color: #007700;">));<br />
</span><span style="color: #0000bb;">$cookieRecipe</span><span style="color: #007700;">-&gt;</span><span style="color: #0000bb;">addIncredient</span><span style="color: #007700;">(new </span><span style="color: #0000bb;">Incredient</span><span style="color: #007700;">(</span><span style="color: #dd0000;">&#8216;Butter&#8217;</span><span style="color: #007700;">,</span><span style="color: #dd0000;">&#8217;1 cup&#8217;</span><span style="color: #007700;">));<br />
</span><span style="color: #0000bb;">$cookieRecipe</span><span style="color: #007700;">-&gt;</span><span style="color: #0000bb;">addIncredient</span><span style="color: #007700;">(new </span><span style="color: #0000bb;">Incredient</span><span style="color: #007700;">(</span><span style="color: #dd0000;">&#8216;Sugar&#8217;</span><span style="color: #007700;">,</span><span style="color: #dd0000;">&#8217;1 cup&#8217;</span><span style="color: #007700;">));<br />
</span><span style="color: #0000bb;">$cookieRecipe</span><span style="color: #007700;">-&gt;</span><span style="color: #0000bb;">addIncredient</span><span style="color: #007700;">(new </span><span style="color: #0000bb;">Incredient</span><span style="color: #007700;">(</span><span style="color: #dd0000;">&#8216;Brown Sugar&#8217;</span><span style="color: #007700;">,</span><span style="color: #dd0000;">&#8217;0.5 cup&#8217;</span><span style="color: #007700;">));<br />
</span><span style="color: #0000bb;">$cookieRecipe</span><span style="color: #007700;">-&gt;</span><span style="color: #0000bb;">addIncredient</span><span style="color: #007700;">(new </span><span style="color: #0000bb;">Incredient</span><span style="color: #007700;">(</span><span style="color: #dd0000;">&#8216;Vanilla extract&#8217;</span><span style="color: #007700;">,</span><span style="color: #dd0000;">&#8217;1 teaspoon&#8217;</span><span style="color: #007700;">));<br />
</span><span style="color: #0000bb;">$cookieRecipe</span><span style="color: #007700;">-&gt;</span><span style="color: #0000bb;">addIncredient</span><span style="color: #007700;">(new </span><span style="color: #0000bb;">Incredient</span><span style="color: #007700;">(</span><span style="color: #dd0000;">&#8216;Egg&#8217;</span><span style="color: #007700;">,</span><span style="color: #dd0000;">&#8217;1-2&#8242;</span><span style="color: #007700;">));<br />
</span><span style="color: #0000bb;">$cookieRecipe</span><span style="color: #007700;">-&gt;</span><span style="color: #0000bb;">addIncredient</span><span style="color: #007700;">(new </span><span style="color: #0000bb;">Incredient</span><span style="color: #007700;">(</span><span style="color: #dd0000;">&#8216;Chocolate chips&#8217;</span><span style="color: #007700;">,</span><span style="color: #dd0000;">&#8217;2 cups&#8217;</span><span style="color: #007700;">));</span></p>
<p><span style="color: #ff8000;">// process recipe:<br />
</span><span style="color: #007700;">foreach(</span><span style="color: #0000bb;">$cookieRecipe </span><span style="color: #007700;">as </span><span style="color: #0000bb;">$inc</span><span style="color: #007700;">) {<br />
echo </span><span style="color: #0000bb;">$inc</span><span style="color: #007700;">-&gt;</span><span style="color: #0000bb;">name</span><span style="color: #007700;">.</span><span style="color: #dd0000;">&#8220; =&gt; &#8221;</span><span style="color: #007700;">.</span><span style="color: #0000bb;">$inc</span><span style="color: #007700;">-&gt;</span><span style="color: #0000bb;">amount</span><span style="color: #007700;">.</span><span style="color: #dd0000;">&#8220;&lt;br/&gt;&#8221;</span><span style="color: #007700;">;<br />
}</span></p>
</div>
<p>As you see it&#8217;s pretty easy to have lists of objects in PHP. You might also think that always creating to some list-object over and over again is very odd and you&#8217;re right. For the most common tasks like <a href="http://www.php.net/manual/en/class.arrayiterator.php">iterating through arrays</a>, <a href="http://www.php.net/manual/en/class.directoryiterator.php">directory-lists</a> and a few more task you can use objects which are shipped with the Standard PHP Library ,which is also part of PHP since version 5 and mandatory in 5.3. So the example shown above could also look like this:</p>
<div id="codeblockIt3" class="code" style="display: block;">
<p><span style="color: #0000bb;">$recipe </span><span style="color: #007700;">= array();<br />
</span><span style="color: #0000bb;">$recipe</span><span style="color: #007700;">[] = new </span><span style="color: #0000bb;">Incredient</span><span style="color: #007700;">(</span><span style="color: #dd0000;">&#8216;Flour&#8217;</span><span style="color: #007700;">,</span><span style="color: #dd0000;">&#8217;2.5 cups&#8217;</span><span style="color: #007700;">);<br />
</span><span style="color: #0000bb;">$recipe</span><span style="color: #007700;">[] = new </span><span style="color: #0000bb;">Incredient</span><span style="color: #007700;">(</span><span style="color: #dd0000;">&#8216;Baking soda&#8217;</span><span style="color: #007700;">,</span><span style="color: #dd0000;">&#8217;1 teaspoon&#8217;</span><span style="color: #007700;">);<br />
</span><span style="color: #0000bb;">$recipe</span><span style="color: #007700;">[] = new </span><span style="color: #0000bb;">Incredient</span><span style="color: #007700;">(</span><span style="color: #dd0000;">&#8216;Salt&#8217;</span><span style="color: #007700;">,</span><span style="color: #dd0000;">&#8217;0.5 teaspoon&#8217;</span><span style="color: #007700;">);<br />
</span><span style="color: #0000bb;">$recipe</span><span style="color: #007700;">[] = new </span><span style="color: #0000bb;">Incredient</span><span style="color: #007700;">(</span><span style="color: #dd0000;">&#8216;Butter&#8217;</span><span style="color: #007700;">,</span><span style="color: #dd0000;">&#8217;1 cup&#8217;</span><span style="color: #007700;">);<br />
</span><span style="color: #0000bb;">$recipe</span><span style="color: #007700;">[] = new </span><span style="color: #0000bb;">Incredient</span><span style="color: #007700;">(</span><span style="color: #dd0000;">&#8216;Sugar&#8217;</span><span style="color: #007700;">,</span><span style="color: #dd0000;">&#8217;1 cup&#8217;</span><span style="color: #007700;">);<br />
</span><span style="color: #0000bb;">$recipe</span><span style="color: #007700;">[] = new </span><span style="color: #0000bb;">Incredient</span><span style="color: #007700;">(</span><span style="color: #dd0000;">&#8216;Brown Sugar&#8217;</span><span style="color: #007700;">,</span><span style="color: #dd0000;">&#8217;0.5 cup&#8217;</span><span style="color: #007700;">);<br />
</span><span style="color: #0000bb;">$recipe</span><span style="color: #007700;">[] = new </span><span style="color: #0000bb;">Incredient</span><span style="color: #007700;">(</span><span style="color: #dd0000;">&#8216;Vanilla extract&#8217;</span><span style="color: #007700;">,</span><span style="color: #dd0000;">&#8217;1 teaspoon&#8217;</span><span style="color: #007700;">);<br />
</span><span style="color: #0000bb;">$recipe</span><span style="color: #007700;">[] = new </span><span style="color: #0000bb;">Incredient</span><span style="color: #007700;">(</span><span style="color: #dd0000;">&#8216;Egg&#8217;</span><span style="color: #007700;">,</span><span style="color: #dd0000;">&#8217;1-2&#8242;</span><span style="color: #007700;">);<br />
</span><span style="color: #0000bb;">$recipe</span><span style="color: #007700;">[] = new </span><span style="color: #0000bb;">Incredient</span><span style="color: #007700;">(</span><span style="color: #dd0000;">&#8216;Chocolate chips&#8217;</span><span style="color: #007700;">,</span><span style="color: #dd0000;">&#8217;2 cups&#8217;</span><span style="color: #007700;">);</span></p>
<p><span style="color: #0000bb;">$recipeIncObj </span><span style="color: #007700;">= new </span><span style="color: #0000bb;">ArrayObject</span><span style="color: #007700;">(</span><span style="color: #0000bb;">$recipe</span><span style="color: #007700;">);<br />
</span><span style="color: #0000bb;">$ingredientsIt </span><span style="color: #007700;">= </span><span style="color: #0000bb;">$recipeIncObj</span><span style="color: #007700;">-&gt;</span><span style="color: #0000bb;">getIterator</span><span style="color: #007700;">(); </span></p>
<p>foreach(<span style="color: #0000bb;">$ingredientsIt </span><span style="color: #007700;">as </span><span style="color: #0000bb;">$inc</span><span style="color: #007700;">) {<br />
echo </span><span style="color: #0000bb;">$inc</span><span style="color: #007700;">-&gt;</span><span style="color: #0000bb;">name</span><span style="color: #007700;">.</span><span style="color: #dd0000;">&#8220; =&gt; &#8221;</span><span style="color: #007700;">.</span><span style="color: #0000bb;">$inc</span><span style="color: #007700;">-&gt;</span><span style="color: #0000bb;">amount</span><span style="color: #007700;">.</span><span style="color: #dd0000;">&#8220;&lt;br/&gt;&#8221;</span><span style="color: #007700;">;<br />
} </span></p>
</div>
<p>As I said at the beginning, there are lots of situations where you might want to have a list for something and if you store that list in PHP the Iterator-pattern can keep your code clean and tasty <img src='http://blog.tolleiv.de/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<script type="text/javascript">
var flattr_wp_ver = '0.9.14';
var flattr_uid = '23199';
var flattr_url = 'http://blog.tolleiv.de';
var flattr_lng = 'en_GB';
var flattr_cat = 'text';
var flattr_tag = 'blog,wordpress,rss,feed';
var flattr_btn = 'large';
var flattr_tle = 'the fancy part of the web';
var flattr_dsc = 'is elsewhere - this is just about all sorts of web related work with a small factor of fanciness';
</script>
<script src="https://api.flattr.com/js/0.5.0/load.js?mode=auto" type="text/javascript"></script> <p>Feel free to Flattr this post at <a href="http://flattr.com/" title="Flattr" target="_blank">flattr.com</a>, if you like it.</p> <p><a href="http://flattr.com/" title="Flattr" target="_blank"><img src="http://blog.tolleiv.de/wp-content/plugins/flattrss/button-compact-static-100x17.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.tolleiv.de/2008/07/iterator-gof/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Null-Object Pattern</title>
		<link>http://blog.tolleiv.de/2008/07/null-object-pattern/</link>
		<comments>http://blog.tolleiv.de/2008/07/null-object-pattern/#comments</comments>
		<pubDate>Tue, 01 Jul 2008 17:58:00 +0000</pubDate>
		<dc:creator>tolleiv</dc:creator>
				<category><![CDATA[behavioral]]></category>
		<category><![CDATA[null]]></category>
		<category><![CDATA[pattern]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://blog.tolleiv.de/2008/07/null-object-pattern/</guid>
		<description><![CDATA[Very often you create a object with a factory and befor [...]]]></description>
			<content:encoded><![CDATA[<p>Very often you create a object with a factory and before you really start using it, you check if your factory really created a object or returned NULL. Or maybe you have a method where a object is passed in and in this situation you&#8217;ll have to do this check also.</p>
<p>Instead of typing the &#8220;<span style="font-style: italic;">if(object == null)</span>&#8221; phrase again and again, you could use the <span style="font-weight: bold;">Null-Object pattern</span>, you&#8217;ll see that this can make some situations much clearer.</p>
<p>Basically Null-Object ensures that the client always receives a valid object for it&#8217;s interaction, so that there&#8217;s no need to do the check shown above again and again. This happens since your concrete Null-Object just shares the interface, or inherits from the same class as it&#8217;s effective counterpart, but it&#8217;s implementation just leaves out any effectiveness.<br />
<a href="http://bp3.blogger.com/_l5fIZzJyYfc/SGpiDZ9m-rI/AAAAAAAAACo/nVuiUHE4E90/s1600-h/nullobject_pattern.png" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" rel="lightbox[584]"><br />
<img id="BLOGGER_PHOTO_ID_5218090928910564018" style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://bp3.blogger.com/_l5fIZzJyYfc/SGpiDZ9m-rI/AAAAAAAAACo/nVuiUHE4E90/s400/nullobject_pattern.png" border="0" alt="" /></a> So a code-example could look like this:</p>
<p><!-- Code start --><br />
<span style="color: #007700;">class </span><span style="color: #0000bb;">CookieFactory </span><span style="color: #007700;">{<br />
public function </span><span style="color: #0000bb;">makeInstance</span><span style="color: #007700;">() {<br />
if(</span><span style="color: #0000bb;">date</span><span style="color: #007700;">(</span><span style="color: #dd0000;">&#8216;l&#8217;</span><span style="color: #007700;">)==</span><span style="color: #dd0000;">&#8216;Monday&#8217;</span><span style="color: #007700;">) return new </span><span style="color: #0000bb;">NullCookie</span><span style="color: #007700;">();<br />
return new </span><span style="color: #0000bb;">RealCookie</span><span style="color: #007700;">();<br />
}<br />
}</span></p>
<p>interface <span style="color: #0000bb;">iCookie </span><span style="color: #007700;">{<br />
function </span><span style="color: #0000bb;">getCalories</span><span style="color: #007700;">();<br />
}</span></p>
<p>class <span style="color: #0000bb;">RealCookie </span><span style="color: #007700;">implements </span><span style="color: #0000bb;">iCookie </span><span style="color: #007700;">{<br />
protected </span><span style="color: #0000bb;">$calories</span><span style="color: #007700;">=</span><span style="color: #0000bb;">250</span><span style="color: #007700;">;<br />
public function </span><span style="color: #0000bb;">getCalories</span><span style="color: #007700;">() {<br />
return </span><span style="color: #0000bb;">$this</span><span style="color: #007700;">-&gt;</span><span style="color: #0000bb;">calories</span><span style="color: #007700;">;<br />
}<br />
}</span></p>
<p>class <span style="color: #0000bb;">NullCookie </span><span style="color: #007700;">implements </span><span style="color: #0000bb;">iCookie </span><span style="color: #007700;">{<br />
public function </span><span style="color: #0000bb;">getCalories</span><span style="color: #007700;">() {<br />
return </span><span style="color: #0000bb;">0</span><span style="color: #007700;">;<br />
}<br />
}<br />
</span><br />
<!-- Code end --></p>
<p>I think you can imagine what happens when you make use of the CookieFactory -<span style="font-style: italic;"> diet on monday <img src='http://blog.tolleiv.de/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </span><span> </span><span style="font-style: italic;"><br />
</span><br />
There&#8217;re also some disadvantages, your clients normally don&#8217;t have a chance to react that there&#8217;s something special </span><span>happening, also the clients must &#8220;share&#8221; the same expectation what &#8220;do nothing&#8221; means, </span></span>the number of required Null-Objects might be very large and unhandy and the Null-Object shares a very deep knowledge with the real one, so that it might be a large effort to create it if the real object is complex too.</p>
<p>I&#8217;m so glad that today is tuesday <img src='http://blog.tolleiv.de/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> </p>
 <p>Feel free to Flattr this post at <a href="http://flattr.com/" title="Flattr" target="_blank">flattr.com</a>, if you like it.</p> <p><a href="http://flattr.com/" title="Flattr" target="_blank"><img src="http://blog.tolleiv.de/wp-content/plugins/flattrss/button-compact-static-100x17.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.tolleiv.de/2008/07/null-object-pattern/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Self-extracting PHP archive</title>
		<link>http://blog.tolleiv.de/2008/06/self-extracting-php-archive/</link>
		<comments>http://blog.tolleiv.de/2008/06/self-extracting-php-archive/#comments</comments>
		<pubDate>Sat, 07 Jun 2008 21:30:00 +0000</pubDate>
		<dc:creator>tolleiv</dc:creator>
				<category><![CDATA[compression]]></category>
		<category><![CDATA[extracting]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[zip]]></category>

		<guid isPermaLink="false">http://blog.tolleiv.de/2008/06/self-extracting-php-archive/</guid>
		<description><![CDATA[The __halt_compiler(); function in php enables to store [...]]]></description>
			<content:encoded><![CDATA[<p>The __halt_compiler(); function in php enables to store some additional data in a php-file without blowing up the memory. A very nice possibility is to use this for a self-extracting php file as installation-packages of your php application.<br />
A wile ago I created a script which automatically creates such a archive and I think you might like it&#8230;.for the impatient ones: <a href="http://588299e40f6cb98516d7458.googlepages.com/createziparchive-0.5.1.php">Download</a> / <a href="http://588299e40f6cb98516d7458.googlepages.com/createziparchive-0.5.1.zip">Download as Zip</a>.</p>
<p>Before I start to show how the entire script works I&#8217;d like to show you a small example so that you can see how the __halt_compiler(); function can be used to store some data at the end of a file:</p>
<pre name="code" class="php">

$fp = fopen(__FILE__, ‘r’);
fseek($fp, __COMPILER_HALT_OFFSET__);
$i=0;
while($buffer = fgets($fp)) {
	echo ($i++). “:”. $buffer.“<br/>”;
};
__HALT_COMPILER();Line 1
Line 2
Line 3
Last line
</pre>
<p>The first thing you might mention is, that the closing &#8220;?&gt;&#8221; is missing, but since the function-name is nearly self-explaining you should realize very fast what the output of the script might be <img src='http://blog.tolleiv.de/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>If that&#8217;s working the question is what&#8217;s needed for a script which is meant to create and extract a archive? The first thing is a way to create the archive itself. I used the PHP-builtin <a href="http://de3.php.net/manual/en/ref.zip.php">ZipArchive</a> for that. The second thing is a script which is able to extract this archiv (using the method show above). That&#8217;s handled by the following snippet:</p>
<pre name="code" class="php">

try {
    $zipfilename = md5(time()).‘archive.zip’; //remove with tempname()
    $fp_tmp = fopen($zipfilename,‘w’);
    $fp_cur = fopen(__FILE__, ‘r’);
    fseek($fp_cur, __COMPILER_HALT_OFFSET__);
    $i=0;
    while($buffer = fread($fp_cur,10240)) {
        fwrite($fp_tmp,$buffer);
    }
    fclose($fp_cur);
    fclose($fp_tmp);
    $zipfile = new ZipArchive();
    if($zipfile->open($zipfilename)===true) {
        if(!$zipfile->extractTo(‘.’)) throw new Exception(‘extraction failed…’);
    } else throw new Exception(‘reading archive failed’);
    $zipfile->close();
    unlink($zipfilename);
} catch (Exception $e) {
    printf(“Error:<br/>%s%s>”,$e->getMessage(),$e->getTraceAsString());
};
__HALT_COMPILER();[zipdata is appended here later]
</pre>
<p>As you see that&#8217;s no rocket-science just read the data, pass it to the ZipArchive object via a temporary file and extract the archive.<br />
If that&#8217;s working then you need a script which brings the PHP extraction script and the zip-data together. And since we want to have a single script for the creation of our self extracting php archive, it would be very odd if we&#8217;d place the &#8220;template&#8221; for the extraction in a separate file. That&#8217;s the reason why I just use the same method as above for this script and this time the data is php code instead of zip-data:</p>
<pre name="code" class="php">

try {
    $sourcefolder = ‘compressthis/’;                 // maybe you want to get this via CLI argument …
    $targetname = ‘phparchive.php’;
    $zipfilename = md5(time()).‘archive.zip’;         // replace with tempname()

    // create a archive from the submitted folder
    $zipfile = new ZipArchive();
    $zipfile->open($zipfilename,ZipArchive::CREATE);
    addFiles2Zip($zipfile,$sourcefolder,true);
    $zipfile->close();

    // compile the selfextracting php-archive
    $fp_dest =fopen($targetname,‘w’);
    $fp_cur = fopen(__FILE__, ‘r’);
    fseek($fp_cur, __COMPILER_HALT_OFFSET__);
    $i=0;
    while($buffer = fgets($fp_cur)) {
        fwrite($fp_dest,$buffer);
    }
    fclose($fp_cur);
    $fp_zip = fopen($zipfilename,‘r’);
    while($buffer = fread($fp_zip,10240)) {
        fwrite($fp_dest,$buffer);
    }
    fclose($fp_zip);
    fclose($fp_dest);
    unlink($zipfilename);

} catch (Exception $e) {
 echo $e->getTraceAsString();
}

function
addFiles2Zip(ZipArchive $zip,$path,$removeFirstFolder=false) {
    $d = opendir($path);
    while($file = readdir($d)) {
        if ($file == “.” || $file == “..”) continue;
        $curfile=($removeFirstFolder)?substr($path.$file,strpos($path,‘/’)+1):$path.$file;
        if(is_dir($path.$file)) {
            $zip->addEmptyDir($curfile);
            addFiles2Zip($zip,$path.$file.‘/’,$removeFirstFolder);
        } else {
            $zip->addFile($path.$file,$curfile);
        }
    }
    closedir($d);
}

__HALT_COMPILER();[the script shown above]
</pre>
<p>If you all wrap up into a single script the you&#8217;ll have something like the <a href="http://588299e40f6cb98516d7458.googlepages.com/createziparchive-0.5.1.php">script I already mentioned.</a><br />
I think that it could be useful to have a version with a better error-handling and maybe also some CLI functions so that there&#8217;s no need to edit the script itself everytime&#8230; I&#8217;ll keep you updated as soon as I have something like that <img src='http://blog.tolleiv.de/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<script type="text/javascript">
var flattr_wp_ver = '0.9.14';
var flattr_uid = '23199';
var flattr_url = 'http://blog.tolleiv.de';
var flattr_lng = 'en_GB';
var flattr_cat = 'text';
var flattr_tag = 'blog,wordpress,rss,feed';
var flattr_btn = 'large';
var flattr_tle = 'the fancy part of the web';
var flattr_dsc = 'is elsewhere - this is just about all sorts of web related work with a small factor of fanciness';
</script>
<script src="https://api.flattr.com/js/0.5.0/load.js?mode=auto" type="text/javascript"></script> <p>Feel free to Flattr this post at <a href="http://flattr.com/" title="Flattr" target="_blank">flattr.com</a>, if you like it.</p> <p><a href="http://flattr.com/" title="Flattr" target="_blank"><img src="http://blog.tolleiv.de/wp-content/plugins/flattrss/button-compact-static-100x17.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.tolleiv.de/2008/06/self-extracting-php-archive/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Comparing PHP Best Practises</title>
		<link>http://blog.tolleiv.de/2008/06/comparing-php-best-practises/</link>
		<comments>http://blog.tolleiv.de/2008/06/comparing-php-best-practises/#comments</comments>
		<pubDate>Mon, 02 Jun 2008 15:37:00 +0000</pubDate>
		<dc:creator>tolleiv</dc:creator>
				<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://blog.tolleiv.de/2008/06/comparing-php-best-practises/</guid>
		<description><![CDATA[If you're still wondering whether the single- or double [...]]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;re still wondering whether the single- or double quotes are processed faster in PHP you might want to look at <a href="http://www.phpbench.com/">phpbench.com</a>. They don&#8217;t provide any ground breaking new insights, but they show in a very nice way what&#8217;s best pratice when it comes to arrays, strings and loops&#8230;</p>
 <p>Feel free to Flattr this post at <a href="http://flattr.com/" title="Flattr" target="_blank">flattr.com</a>, if you like it.</p> <p><a href="http://flattr.com/" title="Flattr" target="_blank"><img src="http://blog.tolleiv.de/wp-content/plugins/flattrss/button-compact-static-100x17.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.tolleiv.de/2008/06/comparing-php-best-practises/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Value Object [DDD]</title>
		<link>http://blog.tolleiv.de/2008/05/value-object-ddd/</link>
		<comments>http://blog.tolleiv.de/2008/05/value-object-ddd/#comments</comments>
		<pubDate>Fri, 30 May 2008 04:39:00 +0000</pubDate>
		<dc:creator>tolleiv</dc:creator>
				<category><![CDATA[behavioral]]></category>
		<category><![CDATA[pattern]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[value object]]></category>

		<guid isPermaLink="false">http://blog.tolleiv.de/2008/05/value-object-ddd/</guid>
		<description><![CDATA[This metaphor does not fit completely, and the "Money-E [...]]]></description>
			<content:encoded><![CDATA[<p><span style="font-style: italic;">This metaphor does not fit completely, and the &#8220;Money-Example&#8221; is omnipresent, but I really like the pattern and so that&#8217;s the story:</span></p>
<p>Let&#8217;s say you have your grannies recipe for a chocolate cookie and you want to keep this in mind, but also you like to somehow experiment with some new or different ingredients. Normally you just keep in mind what you changed and later you write down the new recipe. But from time to time you might want to compare the two recipes or maybe you want to make cookies with the new and the changed recipes. In this situation it&#8217;s really good to have both written down on paper. <img src='http://blog.tolleiv.de/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>In the world of OOP you could think of a solution using the <a href="http://cookiepattern.blogspot.com/search/label/memento?max-results=100">Memento-Pattern</a> but this doesn&#8217;t really fit the situation and it&#8217;s also some kind of overhead. That&#8217;s the reason why the <span style="font-weight: bold;">Value Object</span> is the pattern of my choice.</p>
<p>So let&#8217;s look at the recipes again &#8211; we want to add and remove ingredients without modifying the original recipe and we want to compare the resulting recipes. We don&#8217;t need to track a special identity of our recipes since we&#8217;re only &#8220;collecting&#8221; ingredients.</p>
<p>The idea of the Value Object is that every every method which somehow transforms the state of a object always returns a new object and the old object stays untouched</span><span style="font-family: trebuchet ms; font-size: 85%;">. Whenever needed you should also implement a method to compare objects, I must concede that the common &#8220;Money Example&#8221; shows much better when that&#8217;s needed &#8230;</p>
<p>Another edge of this pattern in PHP is that you can use method-chaining to perform multiple actions within a single line of code. So just have a look at the example you will like it&#8217;s taste <img src='http://blog.tolleiv.de/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<pre name="code" class="php">
class Recipe {
	protected $ingredients;

	public function __construct($ingred=”) {
		$this->ingredients = implode(‘,’,array_unique(explode(‘,’,$ingred)));
	}

	public function addIncredient($ingred=”) {
		return new Recipe($this->ingredients.‘,’.$ingred);
	}

	public function removeIncredien($ingred=”) {
		return new Recipe(preg_replace(‘/,{0,1}’.$ingred.‘,{0,1}/’,”,$this->ingredients.‘,’));
	}

	public function printIncredients() {
		echo str_replace(‘,’,‘<br/>’,$this->ingredients);
	}

	public function equals(Recipe $recipe) {
		return (strcmp($this->ingredients,$recipe->ingredients)===0)?true:false;
	}
}

$granniesRecipe = new Recipe(‘flour,baking soda,sugar,salt,butter,vanilla,chocolate’);
$aNewRecipe = $granniesRecipe->addIncredient(‘lemon’);
$coconutRecipe = $granniesRecipe->removeIncredien(‘chocolate’)->addIncredient(‘coconut’);

// check if that worked:
echo ‘<br/><strong> Grannies Cookie Recipe – Incredients are:</strong><br/>’;
$granniesRecipe->printIncredients();
echo ‘<br/><strong> A new Cookie Recipe could look like:</strong><br/>’;
$aNewRecipe->printIncredients();
echo ‘<br/><strong> A coconut cookie would look like:</strong><br/>’;
$coconutRecipe->printIncredients();
</pre>
<p><span style="font-style: italic;">The implementation is a bit odd, since it only collects the names of the ingredients but not the amount, but including the amounts of incredients would not change the concept  and that&#8217;s why I left it out. I hope you got a idea how the pattern works &#8211; the main thing is that there&#8217;s no identity and that new objects are instantiated as soon as the state of the old one would change.</span></p>
<script type="text/javascript">
var flattr_wp_ver = '0.9.14';
var flattr_uid = '23199';
var flattr_url = 'http://blog.tolleiv.de';
var flattr_lng = 'en_GB';
var flattr_cat = 'text';
var flattr_tag = 'blog,wordpress,rss,feed';
var flattr_btn = 'large';
var flattr_tle = 'the fancy part of the web';
var flattr_dsc = 'is elsewhere - this is just about all sorts of web related work with a small factor of fanciness';
</script>
<script src="https://api.flattr.com/js/0.5.0/load.js?mode=auto" type="text/javascript"></script> <p>Feel free to Flattr this post at <a href="http://flattr.com/" title="Flattr" target="_blank">flattr.com</a>, if you like it.</p> <p><a href="http://flattr.com/" title="Flattr" target="_blank"><img src="http://blog.tolleiv.de/wp-content/plugins/flattrss/button-compact-static-100x17.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.tolleiv.de/2008/05/value-object-ddd/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP FastCGI vs. PHP as a module</title>
		<link>http://blog.tolleiv.de/2008/05/php-fastcgi-vs-php-as-a-module/</link>
		<comments>http://blog.tolleiv.de/2008/05/php-fastcgi-vs-php-as-a-module/#comments</comments>
		<pubDate>Sat, 24 May 2008 17:40:00 +0000</pubDate>
		<dc:creator>tolleiv</dc:creator>
				<category><![CDATA[offtopic]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://blog.tolleiv.de/2008/05/php-fastcgi-vs-php-as-a-module/</guid>
		<description><![CDATA[The apachelounge.org guy published a very interesting s [...]]]></description>
			<content:encoded><![CDATA[<p>The apachelounge.org guy published a very interesting stat which compares the <a href="http://www.apachelounge.com/forum/viewtopic.php?p=10991">memory-usage of PHP/FastCGI and PHP/as module</a> and that&#8217;s really interesting:</p>
<p><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp0.blogger.com/_l5fIZzJyYfc/SDfQbt7tygI/AAAAAAAAABY/D72W5ZIj22c/s1600-h/httpd-ram-week.png" rel="lightbox[567]"><img style="cursor: pointer;" src="http://bp0.blogger.com/_l5fIZzJyYfc/SDfQbt7tygI/AAAAAAAAABY/D72W5ZIj22c/s400/httpd-ram-week.png" alt="" id="BLOGGER_PHOTO_ID_5203857069055003138" border="0" /></a></p>
<p>There&#8217;s no comment about performance and in early versions FastCGI/PHP was a bottleneck but maybe these days are gone <img src='http://blog.tolleiv.de/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
 <p>Feel free to Flattr this post at <a href="http://flattr.com/" title="Flattr" target="_blank">flattr.com</a>, if you like it.</p> <p><a href="http://flattr.com/" title="Flattr" target="_blank"><img src="http://blog.tolleiv.de/wp-content/plugins/flattrss/button-compact-static-100x17.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.tolleiv.de/2008/05/php-fastcgi-vs-php-as-a-module/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP sucks? not really!</title>
		<link>http://blog.tolleiv.de/2008/05/php-sucks-not-really/</link>
		<comments>http://blog.tolleiv.de/2008/05/php-sucks-not-really/#comments</comments>
		<pubDate>Thu, 22 May 2008 06:35:00 +0000</pubDate>
		<dc:creator>tolleiv</dc:creator>
				<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://blog.tolleiv.de/2008/05/php-sucks-not-really/</guid>
		<description><![CDATA[There are so many people from outside of the PHP World  [...]]]></description>
			<content:encoded><![CDATA[<p>There are so many people from outside of the PHP World and lots of them are complaining about PHP and their reasons are mostly so ridiculous. In most cases they just say that PHP code sucks.<br />The PHP 10.0 Blog brought up some good arguments about that and I fully agree &#8211; it&#8217;s not the language that produces sucking code, it&#8217;s the guy who wrote it down. <a href="http://php100.wordpress.com/2008/05/21/secret-of-php/">Click</a></p>
<script type="text/javascript">
var flattr_wp_ver = '0.9.14';
var flattr_uid = '23199';
var flattr_url = 'http://blog.tolleiv.de';
var flattr_lng = 'en_GB';
var flattr_cat = 'text';
var flattr_tag = 'blog,wordpress,rss,feed';
var flattr_btn = 'large';
var flattr_tle = 'the fancy part of the web';
var flattr_dsc = 'is elsewhere - this is just about all sorts of web related work with a small factor of fanciness';
</script>
<script src="https://api.flattr.com/js/0.5.0/load.js?mode=auto" type="text/javascript"></script> <p>Feel free to Flattr this post at <a href="http://flattr.com/" title="Flattr" target="_blank">flattr.com</a>, if you like it.</p> <p><a href="http://flattr.com/" title="Flattr" target="_blank"><img src="http://blog.tolleiv.de/wp-content/plugins/flattrss/button-compact-static-100x17.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.tolleiv.de/2008/05/php-sucks-not-really/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
