<?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>Cynical Optimism &#187; Functions</title>
	<atom:link href="http://evan.verstory.com/category/php/functions/feed/" rel="self" type="application/rss+xml" />
	<link>http://evan.verstory.com</link>
	<description>my views on life and the world</description>
	<lastBuildDate>Tue, 13 Apr 2010 02:38:36 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>array to real list</title>
		<link>http://evan.verstory.com/2008/11/php-array-to-real-list/</link>
		<comments>http://evan.verstory.com/2008/11/php-array-to-real-list/#comments</comments>
		<pubDate>Wed, 26 Nov 2008 04:24:08 +0000</pubDate>
		<dc:creator>Evan</dc:creator>
				<category><![CDATA[Functions]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://evan.verstory.com/?p=166</guid>
		<description><![CDATA[Very simple function, but some newbie might have use for it; could also probably be integrated with Smarty if it&#8217;s not already. Probably should add some error throwing in here, but this works for my purposes.
Enjoy:

&#60;?php

	// turns an array into a &#34;real list&#34;

function array_to_real_list( $array ) {

	$str = &#039;&#039;;

	$last_part = array_pop($array);

	foreach ( $array as $part [...]]]></description>
			<content:encoded><![CDATA[<p>Very simple function, but some newbie might have use for it; could also probably be integrated with Smarty if it&#8217;s not already. Probably should add some error throwing in here, but this works for my purposes.</p>
<p>Enjoy:</p>
<pre class="syntax-highlight:php">
&lt;?php

	// turns an array into a &quot;real list&quot;

function array_to_real_list( $array ) {

	$str = &#039;&#039;;

	$last_part = array_pop($array);

	foreach ( $array as $part ) {
		$str .= trim($part) . &#039;, &#039;;
	}

	$str .= &#039;and &#039; . $last_part;

  return $str;

}

/*	Usage example: ----------------------------------------

	$array = array(&#039;lettuce&#039;, &#039;tomato&#039;, &#039;corn&#039;, &#039;ranch salad dressing&#039;);

echo array_to_real_list($array); // lettuce, tomato, corn, and ranch salad dressing

----------------------------------------------------------- */
</pre>
]]></content:encoded>
			<wfw:commentRss>http://evan.verstory.com/2008/11/php-array-to-real-list/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
