<?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>&#60;Code Zen /&#62; &#187; ascii</title>
	<atom:link href="http://www.code-zen.net/tag/ascii/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.code-zen.net</link>
	<description>Peter Anselmo&#039;s Home on the Web</description>
	<lastBuildDate>Wed, 12 Oct 2011 01:11:59 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Dynamic Display of the Alphabet with PHP</title>
		<link>http://www.code-zen.net/2008/dynamic-display-of-the-alphabet-with-php/</link>
		<comments>http://www.code-zen.net/2008/dynamic-display-of-the-alphabet-with-php/#comments</comments>
		<pubDate>Tue, 23 Dec 2008 21:14:07 +0000</pubDate>
		<dc:creator>Peter Anselmo</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[ascii]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://code-zen.net/?p=138</guid>
		<description><![CDATA[Here&#8217;s a neat trick I recently used: Say you want to the display the alphabet on your web page.  The most likely scenario being for paging links to organize a directory of people or businesses. PHP has a chr() function, which displays the ASCII character for any given integer. Rather than looping through an array [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a neat trick I recently used: Say you want to the display the alphabet on your web page.  The most likely scenario being for paging links to organize a directory of people or businesses. PHP has a chr() function, which displays the ASCII character for any given integer.</p>
<p>Rather than looping through an array with 26 values, or worse yet, typing out 26 lines of code, just loop through the display code 26 times.</p>
<pre>&lt;?php
for ($i=65; $i&lt;=90; $i++) {
 echo chr($i);
}
?&gt;</pre>
<p>For those not familiar with ASCII mappings, values 65-90 represent the uppercase letters A-Z.  Alternately, you could use the values 97-122 for lowercase a-z.  If you wanted to mix the two (say to display uppercase, but use lowercase in the link) just use the strtoupper() or strtolower() functions inside the loop.  Here&#8217;s a more applicable sample:</p>
<pre>&lt;?php
for ($i=97; $i&lt;=122; $i++) {
 $x = chr($i);
 echo '&lt;a href="memberlist.php?alpha=' . $x . '&gt;' . strtoupper($x) . '&lt;/a&gt;';
}
?&gt;

You can see an example of both <a href="http://code-zen.net/sandbox/alphabet.php" target="_blank">applied here</a>.</pre>
<div class="lightsocial_container"><a class="lightsocial_a" href="http://digg.com/submit?url=http%3A%2F%2Fwww.code-zen.net%2F2008%2Fdynamic-display-of-the-alphabet-with-php%2F&amp;title=Dynamic+Display+of+the+Alphabet+with+PHP" ><img class="lightsocial_img" src="http://www.code-zen.net/wp-content/plugins/light-social/digg.png" alt="Digg This" title="Digg This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.reddit.com/submit?url=http%3A%2F%2Fwww.code-zen.net%2F2008%2Fdynamic-display-of-the-alphabet-with-php%2F&amp;title=Dynamic+Display+of+the+Alphabet+with+PHP" ><img class="lightsocial_img" src="http://www.code-zen.net/wp-content/plugins/light-social/reddit.png" alt="Reddit This" title="Reddit This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.code-zen.net%2F2008%2Fdynamic-display-of-the-alphabet-with-php%2F&amp;title=Dynamic+Display+of+the+Alphabet+with+PHP" ><img class="lightsocial_img" src="http://www.code-zen.net/wp-content/plugins/light-social/stumbleupon.png" alt="Stumble Now!" title="Stumble Now!" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://buzz.yahoo.com/buzz?targetUrl=http%3A%2F%2Fwww.code-zen.net%2F2008%2Fdynamic-display-of-the-alphabet-with-php%2F&amp;headline=Dynamic+Display+of+the+Alphabet+with+PHP" ><img class="lightsocial_img" src="http://www.code-zen.net/wp-content/plugins/light-social/yahoo_buzz.png" alt="Buzz This" title="Buzz This" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dzone.com/links/add.html?title=Dynamic+Display+of+the+Alphabet+with+PHP&amp;url=http%3A%2F%2Fwww.code-zen.net%2F2008%2Fdynamic-display-of-the-alphabet-with-php%2F" ><img class="lightsocial_img" src="http://www.code-zen.net/wp-content/plugins/light-social/dzone.png" alt="Vote on DZone" title="Vote on DZone" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.facebook.com/sharer.php?t=Dynamic+Display+of+the+Alphabet+with+PHP&amp;u=http%3A%2F%2Fwww.code-zen.net%2F2008%2Fdynamic-display-of-the-alphabet-with-php%2F" ><img class="lightsocial_img" src="http://www.code-zen.net/wp-content/plugins/light-social/facebook.png" alt="Share on Facebook" title="Share on Facebook" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://delicious.com/save?title=Dynamic+Display+of+the+Alphabet+with+PHP&amp;url=http%3A%2F%2Fwww.code-zen.net%2F2008%2Fdynamic-display-of-the-alphabet-with-php%2F" ><img class="lightsocial_img" src="http://www.code-zen.net/wp-content/plugins/light-social/delicious.png" alt="Bookmark this on Delicious" title="Bookmark this on Delicious" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.dotnetkicks.com/kick/?title=Dynamic+Display+of+the+Alphabet+with+PHP&amp;url=http%3A%2F%2Fwww.code-zen.net%2F2008%2Fdynamic-display-of-the-alphabet-with-php%2F" ><img class="lightsocial_img" src="http://www.code-zen.net/wp-content/plugins/light-social/dotnetkicks.png" alt="Kick It on DotNetKicks.com" title="Kick It on DotNetKicks.com" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://dotnetshoutout.com/Submit?title=Dynamic+Display+of+the+Alphabet+with+PHP&amp;url=http%3A%2F%2Fwww.code-zen.net%2F2008%2Fdynamic-display-of-the-alphabet-with-php%2F" ><img class="lightsocial_img" src="http://www.code-zen.net/wp-content/plugins/light-social/dotnetshoutout.png" alt="Shout it" title="Shout it" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.code-zen.net%2F2008%2Fdynamic-display-of-the-alphabet-with-php%2F&amp;title=Dynamic+Display+of+the+Alphabet+with+PHP&amp;summary=&amp;source=" ><img class="lightsocial_img" src="http://www.code-zen.net/wp-content/plugins/light-social/linkedin.png" alt="Share on LinkedIn" title="Share on LinkedIn" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.technorati.com/faves?add=http%3A%2F%2Fwww.code-zen.net%2F2008%2Fdynamic-display-of-the-alphabet-with-php%2F" ><img class="lightsocial_img" src="http://www.code-zen.net/wp-content/plugins/light-social/technorati.png" alt="Bookmark this on Technorati" title="Bookmark this on Technorati" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://twitter.com/home?status=Reading+http%3A%2F%2Fwww.code-zen.net%2F2008%2Fdynamic-display-of-the-alphabet-with-php%2F" ><img class="lightsocial_img" src="http://www.code-zen.net/wp-content/plugins/light-social/twitter.png" alt="Post on Twitter" title="Post on Twitter" /></a>&nbsp;&nbsp;<a class="lightsocial_a" href="http://www.google.com/buzz/post?url=http%3A%2F%2Fwww.code-zen.net%2F2008%2Fdynamic-display-of-the-alphabet-with-php%2F" ><img class="lightsocial_img" src="http://www.code-zen.net/wp-content/plugins/light-social/google_buzz.png" alt="Google Buzz (aka. Google Reader)" title="Google Buzz (aka. Google Reader)" /></a>&nbsp;&nbsp;</div>]]></content:encoded>
			<wfw:commentRss>http://www.code-zen.net/2008/dynamic-display-of-the-alphabet-with-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

