<?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>Program &#38; Design &#187; PHP</title>
	<atom:link href="http://programanddesign.com/category/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://programanddesign.com</link>
	<description>Tips, tricks, tutorials, and tools on programming &#38; web design</description>
	<lastBuildDate>Sat, 24 Dec 2011 21:44:44 +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>array_map_recursive</title>
		<link>http://programanddesign.com/php/array_map_recursive/</link>
		<comments>http://programanddesign.com/php/array_map_recursive/#comments</comments>
		<pubDate>Wed, 08 Jul 2009 01:28:00 +0000</pubDate>
		<dc:creator>Mark</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://programanddesign.com/?p=277</guid>
		<description><![CDATA[Not much needs to be said here. function array_map_recursive&#40;$callback, $arr&#41; &#123; &#160; &#160; $ret = array&#40;&#41;; &#160; &#160; foreach&#40;$arr as $key =&#62; $val&#41; &#123; &#160; &#160; &#160; &#160; if&#40;is_array&#40;$val&#41;&#41; $ret&#91;$key&#93; = array_map_recursive&#40;$callback, $val&#41;; &#160; &#160; &#160; &#160; else $ret&#91;$key&#93; = $callback&#40;$val&#41;; &#160; &#160; &#125; &#160; &#160; return $ret; &#125; I wrote this so that I [...]]]></description>
		<wfw:commentRss>http://programanddesign.com/php/array_map_recursive/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>SQL Injection Safe Queries Redux</title>
		<link>http://programanddesign.com/php/sql-injection-safe-queries-redux/</link>
		<comments>http://programanddesign.com/php/sql-injection-safe-queries-redux/#comments</comments>
		<pubDate>Tue, 30 Jun 2009 23:42:52 +0000</pubDate>
		<dc:creator>Mark</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://programanddesign.com/?p=258</guid>
		<description><![CDATA[function mysql_safe_string&#40;$value&#41; &#123; &#160; &#160; if&#40;is_numeric&#40;$value&#41;&#41;&#160; &#160; &#160; return $value; &#160; &#160; elseif&#40;empty&#40;$value&#41;&#41; &#160; &#160; &#160; return 'NULL'; &#160; &#160; elseif&#40;is_string&#40;$value&#41;&#41; &#160; return '\''.mysql_real_escape_string&#40;$value&#41;.'\''; &#160; &#160; elseif&#40;is_array&#40;$value&#41;&#41;&#160; &#160; return implode&#40;',',array_map&#40;'mysql_safe_string',$value&#41;&#41;; &#125; function mysql_safe_query&#40;$format&#41; &#123; &#160; &#160; $args = array_slice&#40;func_get_args&#40;&#41;,1&#41;; &#160; &#160; $args = array_map&#40;'mysql_safe_string',$args&#41;; &#160; &#160; $query = vsprintf&#40;$format,$args&#41;; &#160; &#160; $result = mysql_query&#40;$query&#41;; &#160; [...]]]></description>
		<wfw:commentRss>http://programanddesign.com/php/sql-injection-safe-queries-redux/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Facebook PHP API: Get the names of all your friends</title>
		<link>http://programanddesign.com/php/facebook-php-api-get-the-names-of-all-your-friends/</link>
		<comments>http://programanddesign.com/php/facebook-php-api-get-the-names-of-all-your-friends/#comments</comments>
		<pubDate>Tue, 30 Jun 2009 18:07:59 +0000</pubDate>
		<dc:creator>Mark</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://programanddesign.com/?p=251</guid>
		<description><![CDATA[If you didn't already know, Facebook has an API that exposes quite a darn bit information. You can easily query this data using their API, but each request takes a fair bit of time. Typically, to get the names of all your friends, first you have to grab a list of the user ids of [...]]]></description>
		<wfw:commentRss>http://programanddesign.com/php/facebook-php-api-get-the-names-of-all-your-friends/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Get Domain &amp; Subdomain from URL</title>
		<link>http://programanddesign.com/php/get-domain-subdomain-from-url/</link>
		<comments>http://programanddesign.com/php/get-domain-subdomain-from-url/#comments</comments>
		<pubDate>Tue, 23 Jun 2009 22:34:32 +0000</pubDate>
		<dc:creator>Mark</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://programanddesign.com/?p=245</guid>
		<description><![CDATA[preg_match&#40;'/^(?:www\.)?(?:(.+)\.)?(.+\..+)$/i', $_SERVER&#91;'HTTP_HOST'&#93;, $matches&#41;; define&#40;'PROTOCOL', strtolower&#40;substr&#40;$_SERVER&#91;'SERVER_PROTOCOL'&#93;,0,strpos&#40;$_SERVER&#91;'SERVER_PROTOCOL'&#93;,'/'&#41;&#41;&#41;.'://'&#41;; define&#40;'SUBDOMAIN', $matches&#91;1&#93;&#41;; define&#40;'DOMAIN', $matches&#91;2&#93;&#41;; define&#40;'HERE', $_SERVER&#91;'REQUEST_URI'&#93;&#41;; If you're at http://www.sub.domain.com/page, then: PROTOCOL = http:// SUBDOMAIN = sub DOMAIN = domain.com HERE = /page]]></description>
		<wfw:commentRss>http://programanddesign.com/php/get-domain-subdomain-from-url/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>PHP code for handling recursive categories/hierarchical data</title>
		<link>http://programanddesign.com/php/php-code-for-handling-recursive-categorieshierarchical-data/</link>
		<comments>http://programanddesign.com/php/php-code-for-handling-recursive-categorieshierarchical-data/#comments</comments>
		<pubDate>Wed, 10 Jun 2009 06:42:40 +0000</pubDate>
		<dc:creator>Mark</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://programanddesign.com/?p=232</guid>
		<description><![CDATA[I'm just going to paste the code I wrote here... you can read some other tutorial to understand what it's doing, but for some reason they have really incomplete examples, so here's the whole shabang. It will even keep your nodes in alphabetical order. It has a function for displaying a drop down list too; [...]]]></description>
		<wfw:commentRss>http://programanddesign.com/php/php-code-for-handling-recursive-categorieshierarchical-data/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Hash/unhash HTML</title>
		<link>http://programanddesign.com/php/hashunhash-html/</link>
		<comments>http://programanddesign.com/php/hashunhash-html/#comments</comments>
		<pubDate>Fri, 08 May 2009 23:07:33 +0000</pubDate>
		<dc:creator>Mark</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://programanddesign.com/?p=223</guid>
		<description><![CDATA[Here's a little class I wrote that lets you hash HTML and other things so that you can do some processing on just the text, and then unhash the HTML again. class ht &#123; &#160; &#160; &#160; &#160; static $hashes = array&#40;&#41;; &#160; &#160; &#160; &#160; # hashes everything that matches $pattern and saves matches [...]]]></description>
		<wfw:commentRss>http://programanddesign.com/php/hashunhash-html/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP string ends with</title>
		<link>http://programanddesign.com/php/php-string-ends-with/</link>
		<comments>http://programanddesign.com/php/php-string-ends-with/#comments</comments>
		<pubDate>Fri, 08 May 2009 22:50:26 +0000</pubDate>
		<dc:creator>Mark</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://programanddesign.com/?p=219</guid>
		<description><![CDATA[There's a hundred ways to do this, but here's the one I came up with. It doesn't use regex's so it should be pretty quick. function ends_with&#40;$str, $suffix&#41; &#123; &#160; &#160; return substr&#40;$str, -strlen&#40;$suffix&#41;&#41; == $suffix; &#125; function starts_with&#40;$str, $prefix&#41; &#123; &#160; &#160; return substr&#40;$str, 0, strlen&#40;$prefix&#41;&#41; == $prefix; &#125; For completeness, I added the [...]]]></description>
		<wfw:commentRss>http://programanddesign.com/php/php-string-ends-with/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Random String</title>
		<link>http://programanddesign.com/php/random-string/</link>
		<comments>http://programanddesign.com/php/random-string/#comments</comments>
		<pubDate>Fri, 08 May 2009 22:48:05 +0000</pubDate>
		<dc:creator>Mark</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://programanddesign.com/?p=217</guid>
		<description><![CDATA[Just some functions for generating random strings in PHP. function randstr&#40;$len=8, $chars='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'&#41; &#123; &#160; &#160; $i = 0; &#160; &#160; $str = ''; &#160; &#160; $randmax = strlen&#40;$chars&#41;-1; &#160; &#160; for&#40;$i=0; $i&#60;$len; ++$i&#41; &#123; &#160; &#160; &#160; &#160; $str .= $chars&#91;mt_rand&#40;0,$randmax&#41;&#93;; &#160; &#160; &#125; &#160; &#160; return $str; &#125; function randkey&#40;$len=32&#41; &#123; &#160; &#160; return [...]]]></description>
		<wfw:commentRss>http://programanddesign.com/php/random-string/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Encode Array as String</title>
		<link>http://programanddesign.com/php/encode-array-as-string/</link>
		<comments>http://programanddesign.com/php/encode-array-as-string/#comments</comments>
		<pubDate>Fri, 08 May 2009 22:45:41 +0000</pubDate>
		<dc:creator>Mark</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://programanddesign.com/?p=215</guid>
		<description><![CDATA[I wanted to store an array in a cookie, so I wrote these two functions: function encode_arr&#40;$data&#41; &#123; &#160; &#160; return base64_encode&#40;serialize&#40;$data&#41;&#41;; &#125; function decode_arr&#40;$data&#41; &#123; &#160; &#160; return unserialize&#40;base64_decode&#40;$data&#41;&#41;; &#125;]]></description>
		<wfw:commentRss>http://programanddesign.com/php/encode-array-as-string/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Base62 Encode</title>
		<link>http://programanddesign.com/php/base62-encode/</link>
		<comments>http://programanddesign.com/php/base62-encode/#comments</comments>
		<pubDate>Wed, 15 Apr 2009 02:16:36 +0000</pubDate>
		<dc:creator>Mark</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://programanddesign.com/?p=199</guid>
		<description><![CDATA[If you have large integers and you want to shrink them down in size for whatever reason, you can use this code. Should be easy enough to extend if you want even higher bases (just add a few more chars and increase the base). &#60;?php /** &#160;* Converts a base 10 number to any other [...]]]></description>
		<wfw:commentRss>http://programanddesign.com/php/base62-encode/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

