<?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>Playing on the frontier &#187; words</title>
	<atom:link href="http://siphon9.net/loune/tag/words/feed/" rel="self" type="application/rss+xml" />
	<link>http://siphon9.net/loune</link>
	<description></description>
	<lastBuildDate>Sun, 19 Feb 2012 05:57:05 +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>Which words have the letter P in it and what&#8217;s the percentage?</title>
		<link>http://siphon9.net/loune/2009/11/which-words-have-the-letter-p-in-it-and-whats-the-percentage/</link>
		<comments>http://siphon9.net/loune/2009/11/which-words-have-the-letter-p-in-it-and-whats-the-percentage/#comments</comments>
		<pubDate>Sat, 21 Nov 2009 09:26:57 +0000</pubDate>
		<dc:creator>Loune</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[useless]]></category>
		<category><![CDATA[words]]></category>

		<guid isPermaLink="false">http://siphon9.net/loune/?p=108</guid>
		<description><![CDATA[Another code snippet from the useless dept, this time for PHP. If you&#8217;ve ever written a post and wondered how many words use the letter P (or any character), here&#8217;s something for you in PHP: By the way, 17.3% of this post have P&#8217;s in it!]]></description>
			<content:encoded><![CDATA[<p>Another code snippet from the useless dept, this time for PHP. If you&#8217;ve ever written a post and wondered how many words use the letter P (or any character), here&#8217;s something for you in PHP:</p>
<pre class="brush: php; title: ; notranslate">
function find_words_with_letters($letter, $str) {

	$a = preg_split(&quot;#[ \n\r]+#&quot;, $str);

	$letterupper = strtoupper($letter);
	$letterlower = strtolower($letter);

	$result = array();
	$result['word_count'] = count($a);
	$result['words_with_letter'] = array();

	foreach($a as $i) {
		if (strpos($i, $letterlower) !== false || strpos($i, $letterupper) !== false) {
			$result['words_with_letter'][] = $i;
		}
	}
	$result['words_with_letter_ratio'] = count($result['words_with_letter']) / count($a);

	return $result;
}

// use it
print_r(find_words_with_letters('p', 'This message has one P'));
</pre>
<p>By the way, 17.3% of this post have P&#8217;s in it!</p>
]]></content:encoded>
			<wfw:commentRss>http://siphon9.net/loune/2009/11/which-words-have-the-letter-p-in-it-and-whats-the-percentage/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

