<?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>PHP Programmer &#187; PHP Programming</title>
	<atom:link href="http://www.phpprogrammer.co.nz/category/php-programming/feed" rel="self" type="application/rss+xml" />
	<link>http://www.phpprogrammer.co.nz</link>
	<description>Hamish&#039;s blog all about PHP Programming</description>
	<lastBuildDate>Wed, 01 Feb 2012 00:28:47 +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>Speed test: PHP vs Perl vs Python vs Go vs C</title>
		<link>http://www.phpprogrammer.co.nz/speed-test-php-vs-perl-vs-python-vs-go-vs-c</link>
		<comments>http://www.phpprogrammer.co.nz/speed-test-php-vs-perl-vs-python-vs-go-vs-c#comments</comments>
		<pubDate>Mon, 30 Aug 2010 01:06:53 +0000</pubDate>
		<dc:creator>hamish</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[PHP Programming]]></category>

		<guid isPermaLink="false">http://www.phpprogrammer.co.nz/?p=33</guid>
		<description><![CDATA[Recently I have needed to run a cron job every minute on a high load web server. As am currently most fluent in PHP I naturally wrote my script in PHP. However, as it&#039;s running every minute, I do want it to be as fast as possible. Seeing as the script was very simple, I [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I have needed to run a cron job every minute on a high load web server. As am currently most fluent in PHP I naturally wrote my script in PHP. However, as it&#039;s running every minute, I do want it to be as fast as possible. Seeing as the script was very simple, I thought that the most time required to run is in loading the PHP interpreter. Maybe i could use a compiled language instead? What about Google&#039;s new language Go?</p>
<p>Anyway, for my test I wrote a &#034;hello, world&#034; command line app in each language and ran the program 1000 times. Without any further ado, here are the results, from fastest to slowest:</p>
<p>C: 5.37 seconds</p>
<p>Go: 6.23 seconds</p>
<p>Perl: 7.97 seconds</p>
<p>Python: 20.64 seconds</p>
<p>PHP: 41.31 seconds</p>
<p>There you go! PHP is a bit slow for this kind of thing! But I&#039;m not going to write all my scripts in Go or C now (what a hassle!). So, for me&#8230;. perl wins!</p>
<p>Ahh, good old perl, my faithful friend! I will never forget you!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.phpprogrammer.co.nz/speed-test-php-vs-perl-vs-python-vs-go-vs-c/feed</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>UTF-8 checklist</title>
		<link>http://www.phpprogrammer.co.nz/utf-8-checklist</link>
		<comments>http://www.phpprogrammer.co.nz/utf-8-checklist#comments</comments>
		<pubDate>Mon, 27 Apr 2009 04:31:44 +0000</pubDate>
		<dc:creator>hamish</dc:creator>
				<category><![CDATA[PHP Programming]]></category>

		<guid isPermaLink="false">http://www.phpprogrammer.co.nz/utf-8-checklist</guid>
		<description><![CDATA[Character encodings have been driving me insane lately&#8230;. - stuff pasted from word wont display properly - funny square characters in the browser - smart  quotes from word don&#039;t display properly So here&#039; s a handy list of things i have been trying. Some things mgiht work for you, some might not. Let me know [...]]]></description>
			<content:encoded><![CDATA[<p>Character encodings have been driving me insane lately&#8230;.</p>
<p>- stuff pasted from word wont display properly</p>
<p>- funny square characters in the browser</p>
<p>- smart  quotes from word don&#039;t display properly</p>
<p>So here&#039; s a handy list of things i have been trying. Some things mgiht work for you, some might not. Let me know if you have anything to add!</p>
<p><strong>Apache</strong></p>
<p>AddDefaultCharset UTF-8</p>
<p><strong>MySQL</strong></p>
<p>On connect &#8211; SET NAMES &#039;utf8&#039;</p>
<p>Convert: ALTER TABLE tbl_name CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci;<br />
or:</p>
<p>&lt;?<br />
$dbname = $argv[1];<br />
if(!$dbname) {<br />
print &#034;no database specified\n&#034;;<br />
exit;<br />
}<br />
$dbh = mysql_connect(&#039;localhost&#039;, &#039;username&#039;, &#039;password&#039;, 1);<br />
mysql_select_db($dbname);<br />
$sql = &#034;SHOW TABLES&#034;;<br />
$res = mysql_query($sql, $dbh);<br />
while($row = mysql_fetch_assoc($res)) {<br />
$sql2 = &#034;ALTER TABLE $row['Tables_in_{$dbname}'] CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci&#034;;<br />
print $sql2 . &#034;\n&#034;;<br />
}<br />
?&gt;</p>
<p>http://www.oreillynet.com/onlamp/blog/2006/01/turning_mysql_data_in_latin1_t.html</p>
<p>http://gentoo-wiki.com/TIP_Convert_latin1_to_UTF-8_in_MySQL</p>
<p>Also, once all of your databases are utf8 you could set these options in my.cnf:</p>
<p>[mysqld]<br />
default-character-set=utf8<br />
default-collation=utf8_unicode_ci</p>
<p>[client]<br />
default-character-set=utf8</p>
<p><strong>PHP/HTML</strong></p>
<p>&lt;meta http-equiv=&#034;content-type&#034; content=&#034;text/html; charset=utf8&#034; /&gt;<br />
use htmlentities like this:<br />
htmlentities($string, ENT_COMPAT, &#039;UTF-8&#039;)</p>
<p>Magpie RSS:<br />
$rss = new MagpieRSS($rss_string, &#039;UTF-8&#039;, &#039;UTF-8&#039;, false);</p>
]]></content:encoded>
			<wfw:commentRss>http://www.phpprogrammer.co.nz/utf-8-checklist/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CAPTCHA software for PHP</title>
		<link>http://www.phpprogrammer.co.nz/captcha-software-for-php</link>
		<comments>http://www.phpprogrammer.co.nz/captcha-software-for-php#comments</comments>
		<pubDate>Sun, 03 Jun 2007 03:52:18 +0000</pubDate>
		<dc:creator>hamish</dc:creator>
				<category><![CDATA[PHP Programming]]></category>

		<guid isPermaLink="false">http://hamish.geek.nz/php-programmer/captcha-software-for-php</guid>
		<description><![CDATA[I spent a little while looking for a decent captcha module for php. In the end I found that Cryptographp does it for me. Firstly &#8211; it was about the only one I found that uses squiggly type fonts by default (straight fonts are surely to easy to crack). It would be nice if it [...]]]></description>
			<content:encoded><![CDATA[<p>I spent a little while looking for a decent captcha module for php. In the end I found that<a href="http://www.cryptographp.com/"> Cryptographp</a> does it for me. Firstly &#8211; it was about the only one I found that uses squiggly type fonts by default (straight fonts are surely to easy to crack). It would be nice if it worked with E_ALL error reporting though, I had to hack that myself.<a href="http://www.cryptographp.com/">  </a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.phpprogrammer.co.nz/captcha-software-for-php/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

