<?xml version="1.0"?>
<?xml-stylesheet href="/App_Themes/Rss/Rss.xsl" type="text/xsl"?>
<rss version="2.0" xmlns:snippetcenter="http://www.snippetcenter.org/">
<channel>
	<title>snippetcenter.org Comment Feed Base36, Base64 or Base16 functions in PHP</title>
	<link>http://www.snippetcenter.org/</link>
	<description>The newest Comments for Base36, Base64 or Base16 functions in PHP</description>
	<language>en-us</language>
	<copyright>snippetcenter.org</copyright>
	<generator>Advice: This is a RSS Document for reading in your RSS-Reader. Click here for mor informations.</generator>

	<image>
		<url>http://www.snippetcenter.org/Library/Media/Public/button_88x31.png</url>
		<title>snippetcenter.org</title>
		<link>http://www.snippetcenter.org/</link>
		<width>88</width>
		<height>31</height>
	</image>
	
	<item>
     <title><![CDATA[Kommentar von Jeck Lamnent]]></title>
     <guid><![CDATA[http://www.snippetcenter.org/en/base36-base64-or-base16-functions-in-php-s1790.aspx]]></guid>
     <pubDate>Tue, 12 Jan 2010 20:54:19 GMT</pubDate>
     <description><![CDATA[>I'm not sure if this goes against all baseX protocol..

Lol! Dude, you're joking right? Sure numbering systems start with 0, but 0 and 1 are not the same. If you return 1 as 0 then you no longer have 1 do you.

If we simply your modified function down to the basics and feed it a series of 0's and 1's, this would be the result of your function:

function returnBoolean($trueorfalse)
{
   return false;
}

So to anyone reading this, use the original function, not the 'omfg 1 != 0!' function.]]></description>
     <link><![CDATA[http://www.snippetcenter.org/en/base36-base64-or-base16-functions-in-php-s1790.aspx]]></link>
</item>

<item>
     <title><![CDATA[Kommentar von db]]></title>
     <guid><![CDATA[http://www.snippetcenter.org/en/base36-base64-or-base16-functions-in-php-s1790.aspx]]></guid>
     <pubDate>Mon, 04 May 2009 19:57:31 GMT</pubDate>
     <description><![CDATA[So I noticed that your function would not use the first value in the array.  base36(1, 36) would return 1, not 0.

I'm not sure if this goes against all baseX protocol, but here's a function that will utilize the first value of the array:

function base36($x, $base = NULL)
{
	$baseChars = array('0', '1', '2', '3', '4', '5',
                        '6', '7', '8', '9', 'a', 'b',
                        'c', 'd', 'e', 'f', 'g', 'h',
                        'i', 'j', 'k', 'l', 'm', 'n',
                        'o', 'p', 'q', 'r', 's', 't',
                        'u', 'v', 'w', 'x', 'y', 'z'
                      );
	$newVal = '';

	if(is_null($base))
		$base = count($baseChars);

	while($value > 0)
	{
		$remainder = $value % $base;
		$value = (($value - $remainder) / $base);
		if($remainder == 0) # if the remiander is 0, set the offset to the last item in the $chars array, and decrement $x
		{
			$offset = $base - $remainder;
			$value--;
		}
		else
		{
			$offset = $remainder - 1;
		}
		$newVal .= $baseChars[$offset];
	}

	return strrev($newVal);

}]]></description>
     <link><![CDATA[http://www.snippetcenter.org/en/base36-base64-or-base16-functions-in-php-s1790.aspx]]></link>
</item>



</channel>
</rss>
