<?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>MobKool Blog &#187; PHP</title>
	<atom:link href="http://mobkool.com/topic/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://mobkool.com</link>
	<description>Nihil est incertius vulgo - Cicero.   Except for the Kool - Me</description>
	<lastBuildDate>Thu, 28 Jul 2011 23:48:46 +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 Insertion Sort</title>
		<link>http://mobkool.com/2010/02/10/php-insertion-sort/</link>
		<comments>http://mobkool.com/2010/02/10/php-insertion-sort/#comments</comments>
		<pubDate>Wed, 10 Feb 2010 20:38:45 +0000</pubDate>
		<dc:creator>JFP</dc:creator>
				<category><![CDATA[Algorithms]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://mobkool.com/?p=417</guid>
		<description><![CDATA[Insertion sorts are good when your data is already partially sorted, or if you have a small collection to sort. That&#8217;s about the best I can say for them. Here&#8217;s two versions in PHP. The first uses two functions: function insertion_sort($a) { for ($i=1; $i < count($a); $i++) { inserter(&#038;$a,$i,$a[$i]); } } function inserter($a,$pos,$a_value) { [...]]]></description>
			<content:encoded><![CDATA[<p>Insertion sorts are good when your data is already partially sorted, or if you have a small collection to sort. That&#8217;s about the best I can say for them. Here&#8217;s two versions in PHP. The first uses two functions:<br />
<code><br />
function insertion_sort($a)<br />
{<br />
     for ($i=1; $i < count($a); $i++)<br />
     {<br />
         inserter(&#038;$a,$i,$a[$i]);<br />
     }<br />
}<br />
</code><br />
<code><br />
function inserter($a,$pos,$a_value)<br />
{<br />
     $temp = $a[$pos];<br />
     $i = $pos;<br />
     while($i >= 0 &#038;&#038; $a[$i-1] > $a_value)<br />
     {<br />
         $a[$i] = $a[$i-1];<br />
         $i = $i-1;<br />
     }<br />
     $a[$i] = $temp;<br />
}<br />
</code></p>
<p>The second uses one function:</p>
<p><code><br />
function insertion_sort($a)<br />
{<br />
	for($j=1; $j < count($a); $j++)<br />
       {<br />
	        $temp = $a[$j];<br />
	        $i = $j;<br />
	        while(($i >= 0) &#038;&#038; ($a[$i-1] > $temp)){<br />
	                $a[$i] = $a[$i-1];<br />
	                $i--;<br />
	        }<br />
	        $a[$i] = $temp;<br />
	}<br />
}<br />
</code></p>
<p>To test them, use the following code:</p>
<p><code><br />
$haystack = array(1,5,6,3);<br />
insertion_sort(&#038;$haystack);<br />
print_r ($haystack);<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://mobkool.com/2010/02/10/php-insertion-sort/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP Sequential or Linear Search Algorithm</title>
		<link>http://mobkool.com/2010/02/08/php-sequential-or-linear-search-algorithm/</link>
		<comments>http://mobkool.com/2010/02/08/php-sequential-or-linear-search-algorithm/#comments</comments>
		<pubDate>Mon, 08 Feb 2010 22:07:04 +0000</pubDate>
		<dc:creator>JFP</dc:creator>
				<category><![CDATA[Algorithms]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://mobkool.com/?p=406</guid>
		<description><![CDATA[Sequential search, or linear search, is the simplest searching algorithm. Indeed, given it&#8217;s brute force approach of just traversing a collection from the first to last element, it&#8217;s hard to justify calling it an algorithm at all. However, here&#8217;s an example in PHP: function sequential_search($needle,$haystack) { for($i = 0; $i < count($haystack); $i++) { if [...]]]></description>
			<content:encoded><![CDATA[<p>Sequential search, or linear search, is the simplest searching algorithm. Indeed, given it&#8217;s brute force approach of just traversing a collection from the first to last element, it&#8217;s hard to justify calling it an algorithm at all. However, here&#8217;s an example in PHP:<br />
<code><br />
function sequential_search($needle,$haystack) {<br />
	for($i = 0; $i < count($haystack); $i++) {<br />
		if ($needle == $i)<br />
		 return true;<br />
	}<br />
	return false;<br />
}<br />
</code></p>
<p>Here's an example of how you would use this algorithm to look for the number 3 inside an array:</p>
<p><code><br />
$haystack = array(1,2,3,4);<br />
$needle = 3;<br />
$success = sequential_search($needle, $haystack);<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://mobkool.com/2010/02/08/php-sequential-or-linear-search-algorithm/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HipHop for PHP</title>
		<link>http://mobkool.com/2010/02/02/hiphop-for-php/</link>
		<comments>http://mobkool.com/2010/02/02/hiphop-for-php/#comments</comments>
		<pubDate>Tue, 02 Feb 2010 21:52:48 +0000</pubDate>
		<dc:creator>JFP</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Web 2.0]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://mobkool.com/?p=400</guid>
		<description><![CDATA[Here&#8217;s my quick take on HipHop for PHP that was posted by Larry at ZDNet. I&#8217;m attending the HipHop event tonight, and I will add more about it later.]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s <a href="http://blogs.zdnet.com/BTL/?p=30331">my quick take on HipHop for PHP</a> that was posted by Larry at <a href="http://zdnet.com">ZDNet</a>. I&#8217;m attending the HipHop event tonight, and I will add more about it later.</p>
]]></content:encoded>
			<wfw:commentRss>http://mobkool.com/2010/02/02/hiphop-for-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>OpenDNS Needs Coders</title>
		<link>http://mobkool.com/2008/02/25/opendns-needs-coders/</link>
		<comments>http://mobkool.com/2008/02/25/opendns-needs-coders/#comments</comments>
		<pubDate>Mon, 25 Feb 2008 17:52:31 +0000</pubDate>
		<dc:creator>JFP</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Web 2.0]]></category>

		<guid isPermaLink="false">http://www.mobkool.com/wordpress/2008/02/25/opendns-needs-coders/</guid>
		<description><![CDATA[Hey, if you are a PHP coder who is looking to work at a hot startup, check out these jobs at OpenDNS. This is a great company that provides a really great service.]]></description>
			<content:encoded><![CDATA[<p>Hey, if you are a PHP coder who is looking to work at a hot startup, check out <a href="http://www.opendns.com/about/careers/">these jobs</a> at <a href="http://opendns.com">OpenDNS</a>. This is a great company that provides a really great service.</p>
]]></content:encoded>
			<wfw:commentRss>http://mobkool.com/2008/02/25/opendns-needs-coders/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SF PHP Meetup</title>
		<link>http://mobkool.com/2008/01/04/sf-php-meetup/</link>
		<comments>http://mobkool.com/2008/01/04/sf-php-meetup/#comments</comments>
		<pubDate>Sat, 05 Jan 2008 01:19:14 +0000</pubDate>
		<dc:creator>JFP</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Web 2.0]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://www.mobkool.com/wordpress/2008/01/04/sf-php-meetup/</guid>
		<description><![CDATA[I went to another SF PHP Meetup last night. As always, it was highly entertaining, and well worth staying in the city until 10 PM. I love the fact that we host these at CNET now. Big thanks to Tougeron for running these meetings. As you can see from Touge&#8217;s account, Terry was in full [...]]]></description>
			<content:encoded><![CDATA[<p>I went to another <span title="bunch of geeks">SF PHP Meetup</span> last night. As always, it was highly entertaining, and well worth staying in the city until 10 PM. I love the fact that we host these at <a href="http://cnetnetworks.com">CNET</a> now. Big thanks to <a href="http://www.grepmymind.com/">Tougeron</a> for running these meetings. As you can see from <a href="http://www.grepmymind.com/2008/01/04/sf-php-meetup-the-next-day/">Touge&#8217;s account</a>, <a href="http://terrychay.com">Terry</a> was in full effect (that&#8217;s a good thing). Next time, <a href="http://andrewmager.com">Mager</a> should come instead of watching VT getting their ass kicked.</span></p>
]]></content:encoded>
			<wfw:commentRss>http://mobkool.com/2008/01/04/sf-php-meetup/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP Bubble Sort</title>
		<link>http://mobkool.com/2007/12/30/php-bubble-sort/</link>
		<comments>http://mobkool.com/2007/12/30/php-bubble-sort/#comments</comments>
		<pubDate>Mon, 31 Dec 2007 04:02:22 +0000</pubDate>
		<dc:creator>JFP</dc:creator>
				<category><![CDATA[Algorithms]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.mobkool.com/wordpress/2007/12/30/php-bubble-sort/</guid>
		<description><![CDATA[One of an occasional series of posts on PHP algorithms. I found this originally at United Scripters, and bookmarked it for some reason. Code function bubbleSort($array=array()/*could have been a pointer*/){ $lastIndex=sizeof($array)-1; while(true){ $newStartIndex=false; $newLastIndex=0; for($j=($startIndex)?$startIndex:1; $j&#60;=$lastIndex; $j++){ if( $array[$j-1] &#62; $array[$j] ){/*SWAP:*/ $temp=$array[$j-1]; $array[$j-1]=$array[$j]; $array[$j]=$temp; if($newStartIndex===false){$newStartIndex=$j-1;}; $newLastIndex=$j-1; }; } if($newStartIndex===false){return $array;}; $startIndex=$newStartIndex; $lastIndex=$newLastIndex; } /* [...]]]></description>
			<content:encoded><![CDATA[<p>One of an occasional series of posts on PHP algorithms. I found this originally at <a href="http://www.unitedscripters.com/index.html?file=/phps/bubblesort.html">United Scripters</a>, and bookmarked it for some reason.</p>
<p><strong>Code</strong></p>
<p>function bubbleSort($array=array()/*could have been a pointer*/){<br />
$lastIndex=sizeof($array)-1;<br />
while(true){<br />
$newStartIndex=false;<br />
$newLastIndex=0;<br />
for($j=($startIndex)?$startIndex:1; $j&lt;=$lastIndex; $j++){<br />
if( $array[$j-1] &gt; $array[$j] ){/*SWAP:*/<br />
$temp=$array[$j-1];<br />
$array[$j-1]=$array[$j];<br />
$array[$j]=$temp;<br />
if($newStartIndex===false){$newStartIndex=$j-1;};<br />
$newLastIndex=$j-1;<br />
};<br />
}<br />
if($newStartIndex===false){return $array;};<br />
$startIndex=$newStartIndex;<br />
$lastIndex=$newLastIndex;<br />
}<br />
/* keep this comment to reuse freely:<br />
Orwant, Hietaniemi, Macdonald algorithm as Php implemented by:<br />
http://www.unitedscripters.com */<br />
}</p>
]]></content:encoded>
			<wfw:commentRss>http://mobkool.com/2007/12/30/php-bubble-sort/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>In Defense of PHP</title>
		<link>http://mobkool.com/2006/02/22/in-defense-of-php/</link>
		<comments>http://mobkool.com/2006/02/22/in-defense-of-php/#comments</comments>
		<pubDate>Wed, 22 Feb 2006 02:03:05 +0000</pubDate>
		<dc:creator>JFP</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://slantwise.wordpress.com/2006/02/22/in-defense-of-php/</guid>
		<description><![CDATA[There is lots of PHP hatred on the web. It doesn&#8217;t seem to matter that some of the biggest sites on the web run PHP, including Yahoo and CNET&#8217;s own Gamespot: PHP still doesn&#8217;t get any respect. Anyway, for all PHP lovers out there, here&#8217;s two excellent defenses of PHP: Why PHP Scales &#8211; A [...]]]></description>
			<content:encoded><![CDATA[<p>There is lots of PHP hatred on the web. It doesn&#8217;t seem to matter that some of the biggest sites on the web run PHP, including Yahoo and CNET&#8217;s own Gamespot: PHP still doesn&#8217;t get any respect. Anyway, for all PHP lovers out there, here&#8217;s two excellent defenses of PHP: <a href="http://www.schlossnagle.org/~george/blog/index.php?/archives/29-Why-PHP-Scales-A-Cranky,-Snarky-Answer.html">Why PHP Scales &#8211; A Cranky, Snarky Answer</a> and <a href="http://www.sitepoint.com/blogs/2006/02/21/a-pro-php-rant/">A pro-php-rant</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://mobkool.com/2006/02/22/in-defense-of-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

