<?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>GraysUnderground.com &#187; PHP</title>
	<atom:link href="http://www.graysunderground.com/category/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.graysunderground.com</link>
	<description>Gray's Tech Blog</description>
	<lastBuildDate>Thu, 20 May 2010 17:31:11 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Validate an email address using regular expressions</title>
		<link>http://www.graysunderground.com/2009/04/15/validate-an-email-address-using-regular-expressions/</link>
		<comments>http://www.graysunderground.com/2009/04/15/validate-an-email-address-using-regular-expressions/#comments</comments>
		<pubDate>Wed, 15 Apr 2009 21:55:41 +0000</pubDate>
		<dc:creator>Gray</dc:creator>
				<category><![CDATA[PHP]]></category>

	<!-- AutoMeta Start -->
	<category></category>
	<!-- AutoMeta End -->
	
		<guid isPermaLink="false">http://www.graysunderground.com/2009/04/15/validate-an-email-address-using-regular-expressions/</guid>
		<description><![CDATA[If you want a PHP script to validate an email address here is a quick and simple PHP regular expression to do it. This script is also case-insensitive, so it will treat all characters as lower case. This script is a simple and  easy way to check the syntax and format of an email address.
The [...]]]></description>
			<content:encoded><![CDATA[<p>If you want a PHP script to validate an email address here is a quick and simple PHP regular expression to do it. This script is also case-insensitive, so it will treat all characters as lower case. This script is a simple and  easy way to check the syntax and format of an email address.</p>
<h2>The code</h2>
<pre><code><span style="color: #000000">
<span style="color: #0000bb">&lt;?php

$email </span><span style="color: #007700">= </span><span style="color: #dd0000">"someone@example.com"</span><span style="color: #007700">;

if(</span><span style="color: #0000bb">eregi</span><span style="color: #007700">(</span><span style="color: #dd0000">"^[_a-z0-9-]+(.[_a-z0-9-]+)*@[a-z0-9-]+(.[a-z0-9-]+)*(.[a-z]{2,3})$"</span><span style="color: #007700">, </span><span style="color: #0000bb">$email</span><span style="color: #007700">)) {

  echo </span><span style="color: #dd0000">"Valid email address."</span><span style="color: #007700">;

}

else {

  echo </span><span style="color: #dd0000">"Invalid email address."</span><span style="color: #007700">;

}

</span><span style="color: #0000bb">?&gt;</span>
</span>
</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.graysunderground.com/2009/04/15/validate-an-email-address-using-regular-expressions/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>PHP Frameworks</title>
		<link>http://www.graysunderground.com/2008/05/24/php-frameworks/</link>
		<comments>http://www.graysunderground.com/2008/05/24/php-frameworks/#comments</comments>
		<pubDate>Sat, 24 May 2008 21:46:33 +0000</pubDate>
		<dc:creator>Gray</dc:creator>
				<category><![CDATA[PHP]]></category>

	<!-- AutoMeta Start -->
	<category></category>
	<!-- AutoMeta End -->
	
		<guid isPermaLink="false">http://www.graysunderground.com/2008/05/24/php-frameworks/</guid>
		<description><![CDATA[Been thinking of using a PHP framework found a very interesting slideshow on the Zend Framework. Any opinions?

 &#124; View &#124; Upload your own


]]></description>
			<content:encoded><![CDATA[<p>Been thinking of using a PHP framework found a very interesting slideshow on the Zend Framework. Any opinions?</p>
<div style="width:425px;text-align:left" id="__ss_62816"><object style="margin:0px" height="355" width="425"><param name="movie" value="http://static.slideshare.net/swf/ssplayer2.swf?doc=phpbootcamp-zend-framework544"/><param name="allowFullScreen" value="true"/><param name="allowScriptAccess" value="always"/><embed src="http://static.slideshare.net/swf/ssplayer2.swf?doc=phpbootcamp-zend-framework544" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="355"></embed></object>
<div style="font-size:11px;font-family:tahoma,arial;height:26px;padding-top:2px;"><a href="http://www.slideshare.net/?src=embed"><img src="http://static.slideshare.net/swf/logo_embd.png" style="border:0px none;margin-bottom:-5px" alt="SlideShare"/></a> | <a href="http://www.slideshare.net/thomasw/phpbootcamp-zend-framework" title="View this slideshow on SlideShare">View</a> | <a href="http://www.slideshare.net/upload">Upload your own</a></div>
</div>
<p><img style="visibility:hidden;width:0px;height:0px;" border=0 width=0 height=0 src="http://counters.gigya.com/wildfire/CIMP/bT*xJmx*PTEyMTE1Nzg3ODg5MzMmcHQ9MTIxMTU3ODc5MzE3OCZwPTEwMTkxJmQ9Jm49Jmc9Mg==.jpg" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.graysunderground.com/2008/05/24/php-frameworks/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Top 10 Scalability Mistakes with PHP</title>
		<link>http://www.graysunderground.com/2008/05/23/top-10-scalability-mistakes-with-php/</link>
		<comments>http://www.graysunderground.com/2008/05/23/top-10-scalability-mistakes-with-php/#comments</comments>
		<pubDate>Fri, 23 May 2008 21:02:02 +0000</pubDate>
		<dc:creator>Gray</dc:creator>
				<category><![CDATA[PHP]]></category>

	<!-- AutoMeta Start -->
	<category></category>
	<!-- AutoMeta End -->
	
		<guid isPermaLink="false">http://www.graysunderground.com/2008/05/23/top-10-scalability-mistakes-with-php/</guid>
		<description><![CDATA[Found a great slide that talks about the top 10 mistakes when programming scalable applications with PHP. Discusses everything from hardware to AJAX. The AJAX piece I found to be very interesting. Check it out and give me your thoughts.

 &#124; View &#124; Upload your own

]]></description>
			<content:encoded><![CDATA[<p>Found a great slide that talks about the top 10 mistakes when programming scalable applications with PHP. Discusses everything from hardware to AJAX. The AJAX piece I found to be very interesting. Check it out and give me your thoughts.</p>
<div style="width:425px;text-align:left" id="__ss_157937"><object style="margin:0px" width="425" height="355"><param name="movie" value="http://static.slideshare.net/swf/ssplayer2.swf?doc=top-10-scalability-mistakes-1194421978989888-1"/><param name="allowFullScreen" value="true"/><param name="allowScriptAccess" value="always"/><embed src="http://static.slideshare.net/swf/ssplayer2.swf?doc=top-10-scalability-mistakes-1194421978989888-1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="355"></embed></object>
<div style="font-size:11px;font-family:tahoma,arial;height:26px;padding-top:2px;"><a href="http://www.slideshare.net/?src=embed"><img src="http://static.slideshare.net/swf/logo_embd.png" style="border:0px none;margin-bottom:-5px" alt="SlideShare"/></a> | <a href="http://www.slideshare.net/coogle/top-10-scalability-mistakes?src=embed" title="View Top 10 Scalability Mistakes on SlideShare">View</a> | <a href="http://www.slideshare.net/upload?src=embed">Upload your own</a></div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.graysunderground.com/2008/05/23/top-10-scalability-mistakes-with-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Quick and easy PHP function to Validate email strings.</title>
		<link>http://www.graysunderground.com/2008/04/25/quick-and-easy-php-function-to-validate-email-strings/</link>
		<comments>http://www.graysunderground.com/2008/04/25/quick-and-easy-php-function-to-validate-email-strings/#comments</comments>
		<pubDate>Fri, 25 Apr 2008 16:52:09 +0000</pubDate>
		<dc:creator>Gray</dc:creator>
				<category><![CDATA[PHP]]></category>

	<!-- AutoMeta Start -->
	<category></category>
	<!-- AutoMeta End -->
	
		<guid isPermaLink="false">http://www.graysunderground.com/2008/04/25/quick-and-easy-php-function-to-validate-email-strings/</guid>
		<description><![CDATA[Quick and easy way to validate email strings. I picked this bit of code up from somewhere, not sure where&#8230;.Think it was the Zend site. Credit goes to the original unknown author, not me.
&#60;?php
 function is_email($address) {
 $rc1 = (ereg('^[-!#$%&#38;'*+./0-9=?A-Z^_`a-z{&#124;}~]+'.
'@'.
'[-!#$%&#38;'*+\/0-9=?A-Z^_`a-z{&#124;}~]+.'.
'[-!#$%&#38;'*+\./0-9=?A-Z^_`a-z{&#124;}~]+$',
 $address));
 $rc2 = (preg_match('/.+.ww+$/',$address));
return ($rc1 &#38;&#38; $rc2);
}
 ?&#62;
]]></description>
			<content:encoded><![CDATA[<p>Quick and easy way to validate email strings. I picked this bit of code up from somewhere, not sure where&#8230;.Think it was the Zend site. Credit goes to the original unknown author, not me.</p>
<p><code><font color="#000000"><font color="#0000bb">&lt;?php<br />
</font> <font color="#007700">function</font> <font color="#0000bb">is_email</font><font color="#007700">(</font><font color="#0000bb">$address</font><font color="#007700">) {<br />
</font> <font color="#0000bb">$rc1</font> <font color="#007700">= (</font><font color="#0000bb">ereg</font><font color="#007700">(</font><font color="#dd0000">'^[-!#$%&amp;'</font><font color="#007700">*+./</font><font color="#0000bb">0</font><font color="#007700">-</font><font color="#0000bb">9</font><font color="#007700">=?</font><font color="#0000bb">A</font><font color="#007700">-</font><font color="#0000bb">Z</font><font color="#007700">^</font><font color="#0000bb">_</font><font color="#007700">`</font><font color="#0000bb">a-z</font><font color="#007700">{</font><font color="#0000bb">|</font><font color="#007700">}</font><font color="#0000bb">~</font><font color="#007700">]</font><font color="#0000bb">+'.<br />
'@'.<br />
'</font><font color="#007700">[</font><font color="#0000bb">-!#</font><font color="#007700">$</font><font color="#0000bb">%&amp;'*+\/0-9=?A-Z^_</font><font color="#007700">`</font><font color="#0000bb">a</font><font color="#007700">-</font><font color="#0000bb">z</font><font color="#007700">{|}~]+.</font><font color="#dd0000">'.<br />
'</font><font color="#007700">[-!</font><font color="#ff8000">#$%&amp;'*+\./0-9=?A-Z^_`a-z{|}~]+$',<br />
</font> <font color="#0000bb">$address</font><font color="#007700">));<br />
</font> <font color="#0000bb">$rc2</font> <font color="#007700">= (</font><font color="#0000bb">preg_match</font><font color="#007700">(</font><font color="#dd0000">'/.+.ww+$/'</font><font color="#007700">,</font><font color="#0000bb">$address</font><font color="#007700">));<br />
return (</font><font color="#0000bb">$rc1</font> <font color="#007700">&amp;&amp;</font> <font color="#0000bb">$rc2</font><font color="#007700">);<br />
}<br />
</font> <font color="#0000bb">?&gt;</font></font></code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.graysunderground.com/2008/04/25/quick-and-easy-php-function-to-validate-email-strings/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Quick tip for you PHP/Opera Users!</title>
		<link>http://www.graysunderground.com/2008/04/24/quick-tip-for-you-phpopera-users/</link>
		<comments>http://www.graysunderground.com/2008/04/24/quick-tip-for-you-phpopera-users/#comments</comments>
		<pubDate>Thu, 24 Apr 2008 16:49:21 +0000</pubDate>
		<dc:creator>Gray</dc:creator>
				<category><![CDATA[Opera]]></category>
		<category><![CDATA[PHP]]></category>

	<!-- AutoMeta Start -->
	<category></category>
	<!-- AutoMeta End -->
	
		<guid isPermaLink="false">http://www.graysunderground.com/2008/04/24/quick-tip-for-you-phpopera-users/</guid>
		<description><![CDATA[  In Opera, go to Tools &#8211;&#62; Preferences, and click on the search tab. You  should &#8220;Add a new search engine&#8221; and fill in the blanks. Here is what I use:.

Name: PHP
Keyword: p
Address: http://www.php.net/search.php
Query string: pattern=%s&#38;show=quickref

  You have to check &#8220;Use POST&#8221; to be able to type in a query string.
Click OK, [...]]]></description>
			<content:encoded><![CDATA[<p>  In Opera, go to Tools &#8211;&gt; Preferences, and click on the search tab. You  should &#8220;Add a new search engine&#8221; and fill in the blanks. Here is what I use:.</p>
<ul>
<li>Name: PHP</li>
<li>Keyword: p</li>
<li>Address: http://www.php.net/search.php</li>
<li>Query string: pattern=%s&amp;show=quickref</li>
</ul>
<p class="note">  You have to check &#8220;Use POST&#8221; to be able to type in a query string.</p>
<p>Click OK, and then click Ok.</p>
<p>From now on you will be able to search  the PHP function list by typing &#8220;p function&#8221; in the address bar. You can change &#8220;quickref&#8221; to &#8220;all&#8221; if you want to  search all php.net sites, or &#8220;manual&#8221; for the online documentation.</p>
<p>Enjoy! I orignally picked this tip up from PHP.net, don&#8217;t know the exact URL tho.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.graysunderground.com/2008/04/24/quick-tip-for-you-phpopera-users/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP &#8211; Convert American to European Date Format</title>
		<link>http://www.graysunderground.com/2007/10/16/php-convert-american-to-european-date-format/</link>
		<comments>http://www.graysunderground.com/2007/10/16/php-convert-american-to-european-date-format/#comments</comments>
		<pubDate>Tue, 16 Oct 2007 14:38:45 +0000</pubDate>
		<dc:creator>Gray</dc:creator>
				<category><![CDATA[PHP]]></category>

	<!-- AutoMeta Start -->
	<category></category>
	<!-- AutoMeta End -->
	
		<guid isPermaLink="false">http://www.graysunderground.com/2007/10/16/php-convert-american-to-european-date-format/</guid>
		<description><![CDATA[Found a great little snippet of code to use for converting from American to Euro date format and back.

$date=’12/31/2006’;
print ereg_replace(”([0-9] )/([0-9] )/([0-9] )”,”\\2/\\1/\\3″,$date);
Thanks to last-child.com for the Snippet.
And from the comments below an even shorter snippet:
echo date( ‘m-d-Y’, strtotime( $date) );
Thanks Justin!
]]></description>
			<content:encoded><![CDATA[<p>Found a great little snippet of code to use for converting from American to Euro date format and back.</p>
<blockquote><p><code><br />
$date=’12/31/2006’;<br />
print ereg_replace(”([0-9] )/([0-9] )/([0-9] )”,”\\2/\\1/\\3″,$date);</code></p></blockquote>
<p>Thanks to <a href="http://www.last-child.com/convert-american-date-format-to-european-and-vice-versa">last-child.com</a> for the Snippet.</p>
<p>And from the comments below an even shorter snippet:</p>
<p>echo date( ‘m-d-Y’, strtotime( $date) );</p>
<p>Thanks Justin!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.graysunderground.com/2007/10/16/php-convert-american-to-european-date-format/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>How to speed up PHP</title>
		<link>http://www.graysunderground.com/2007/05/15/how-to-speed-up-php/</link>
		<comments>http://www.graysunderground.com/2007/05/15/how-to-speed-up-php/#comments</comments>
		<pubDate>Wed, 16 May 2007 02:27:20 +0000</pubDate>
		<dc:creator>Gray</dc:creator>
				<category><![CDATA[PHP]]></category>

	<!-- AutoMeta Start -->
	<category></category>
	<!-- AutoMeta End -->
	
		<guid isPermaLink="false">http://www.graysunderground.com/?p=6</guid>
		<description><![CDATA[The following methods can help improve scalability with php applications.
1. object code caching
Whenever a request comes in for a php script, it has to go through the compiler and then execute the object code. If this is cached, you skip compiling and go straight to executing, hence a speed increase
There are quite a few object [...]]]></description>
			<content:encoded><![CDATA[<p>The following methods can help improve scalability with php applications.</p>
<p>1. object code caching</p>
<p>Whenever a request comes in for a php script, it has to go through the compiler and then execute the object code. If this is cached, you skip compiling and go straight to executing, hence a speed increase</p>
<p>There are quite a few object code caching packages, some are free and some are not:</p>
<p>A) Ioncube: http://www.ioncube.com/</p>
<p>B) Zend Encoder: http://www.zend.com/products/zend_safeguard (Not Bad)</p>
<p>C) Turckl MMCache: http://freshmeat.net/projects/turck-mmcache/  (My Fav)</p>
<p>1. Templating systems</p>
<p>Templating systems provide a different type of caching. HTML caching. Templating systems work well when you have static data on one or many of your pages that doesn’t need to be reloaded often. Caching systems also provide a separation of code and html, simplifying the system and making future additions or upgrades easier. </p>
<p>A) Smarty Templates: http://smarty.php.net/ (MY fav)</p>
<p>B) Pear Templates: http://pear.php.net/package/html_template_it/redirected</p>
<p>3. Distributed object caching systems</p>
<p>The most widely used system of this type is memcached (http://www.danga.com/memcached/).</p>
<p>This type of caching makes your database querying faster by caching the majority of your database queries.</p>
<p>4. PHP variables that can be set</p>
<p>variables_order = ‘GPC’<br />
register_argc_argv = ‘Off’<br />
register_globals = ‘Off’ (this is a good idea to keep off for security purposes as well)<br />
always_populate_raw_post_data = ‘Off’<br />
magic_quotes_gpc = ‘Off’</p>
<p>Use IP address to access your database. Do this as much as possible as you save the hostname lookup time..</p>
<p>5. Output Compression</p>
<p>Most current browsers now support gzip compression. Gzip compression can decrease the overall size of your output by up to 80%, but with a tradeoff: cpu usage will go up by around 10%. This will actually compress your HTML output befor sending to the browser, decreasing your bandwdth usage and speeding up the page loading.</p>
<p>add the following lines to php.ini to enable:</p>
<p>zlib.output_compression = On<br />
zlib.output_compression_level = (level) (where level is 1-9. Youy may want to try different values to see what is best for your system).</p>
<p>if you are using apache, you can also enable the mod_gzip module. It is highly configurable, with the ability to modify output based on MIME types, files, or browser settings.</p>
<p>6. Optimize your database and queries.</p>
<p>Query only what you need, avoid SELECTING * and please, please, please index your tables!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.graysunderground.com/2007/05/15/how-to-speed-up-php/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>AJAX for PHP without the Javascript</title>
		<link>http://www.graysunderground.com/2007/04/26/ajax-for-php-without-writing-javascript/</link>
		<comments>http://www.graysunderground.com/2007/04/26/ajax-for-php-without-writing-javascript/#comments</comments>
		<pubDate>Fri, 27 Apr 2007 02:10:50 +0000</pubDate>
		<dc:creator>Gray</dc:creator>
				<category><![CDATA[PHP]]></category>

	<!-- AutoMeta Start -->
	<category></category>
	<!-- AutoMeta End -->
	
		<guid isPermaLink="false">http://www.graysunderground.com/?p=5</guid>
		<description><![CDATA[I know there are web developers out there that know squat about JavaScript. I know, I am one of them, I mean I can write something if I really have to but most things you need done with JavaScript you can find someone who has written a script, reference, library, framework that already does it&#8230;.So [...]]]></description>
			<content:encoded><![CDATA[<p>I know there are web developers out there that know squat about JavaScript. I know, I am one of them, I mean I can write something if I really have to but most things you need done with JavaScript you can find someone who has written a script, reference, library, framework that already does it&#8230;.So that leaves most web developers more concerned with the server side scripting languages. Anyway I ran across a great framework for PHP programmers, QuTags, it does most of the work for you and is handy in a pinch. Has some great tutorials on their site and you can even get this as an apache C mod. Check it out.<br />
<a href="http://www.ajaxforphp.com/qutags/"></p>
<p>http://www.ajaxforphp.com/qutags/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.graysunderground.com/2007/04/26/ajax-for-php-without-writing-javascript/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Great PERL PHP Translations</title>
		<link>http://www.graysunderground.com/2007/01/26/great-perl-php-translations/</link>
		<comments>http://www.graysunderground.com/2007/01/26/great-perl-php-translations/#comments</comments>
		<pubDate>Sat, 27 Jan 2007 01:51:59 +0000</pubDate>
		<dc:creator>Gray</dc:creator>
				<category><![CDATA[PERL]]></category>
		<category><![CDATA[PHP]]></category>

	<!-- AutoMeta Start -->
	<category></category>
	<!-- AutoMeta End -->
	
		<guid isPermaLink="false">http://www.graysunderground.com/?p=3</guid>
		<description><![CDATA[You know when your programming in PERL or PHP and you just can&#8217;t think of that corresponding function? Well ease your mind. I have found a list that pairs them off and makes translating, either way, an much easier task.  This list is great even if your not  trying to translate from one [...]]]></description>
			<content:encoded><![CDATA[<p>You know when your programming in PERL or PHP and you just can&#8217;t think of that corresponding function? Well ease your mind. I have found a list that pairs them off and makes translating, either way, an much easier task.  This list is great even if your not  trying to translate from one to the other, its just handy to look up functions while your coding.</p>
<p><a href="http://www.cs.wcupa.edu/~rkline/perl2php/#basedir">http://www.cs.wcupa.edu/~rkline/perl2php/#basedir</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.graysunderground.com/2007/01/26/great-perl-php-translations/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
