<?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>RandomBase</title>
	<atom:link href="http://www.randombase.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.randombase.com</link>
	<description>A website containing many different projects and scripts.</description>
	<lastBuildDate>Sun, 07 Mar 2010 10:46:50 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>Update blah blah blah</title>
		<link>http://www.randombase.com/2010/03/update-blah-blah-blah/</link>
		<comments>http://www.randombase.com/2010/03/update-blah-blah-blah/#comments</comments>
		<pubDate>Sun, 07 Mar 2010 10:46:50 +0000</pubDate>
		<dc:creator>Iron</dc:creator>
				<category><![CDATA[RandomBase news]]></category>

		<guid isPermaLink="false">http://www.randombase.com/?p=150</guid>
		<description><![CDATA[It&#8217;s been quite a busy week: I went to CeBIT  and Battlefield Bad Company 2 launched, reason enough not to post any news in my opinion!
So, on the CeBIT side: it was partially interesting, boring, nice, mostly Asian companies no one ever heard of and a lot of business suits.
On the Bad Company side: [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s been quite a busy week: I went to <a href="http://www.cebit.de/homepage_e">CeBIT </a> and Battlefield Bad Company 2 launched, reason enough not to post any news in my opinion!</p>
<p>So, on the CeBIT side: it was partially interesting, boring, nice, mostly Asian companies no one ever heard of and a lot of business suits.</p>
<p>On the Bad Company side: DICE screwed up another launch, but I was so used to it I remained calm and fixed every fixable issue for myself until I had a playable game. It&#8217;s much like the Battlefield Heroes launch: it was near-impossible to get into a game, but once you were it was absolutely awesome and impressive. I&#8217;m currently a rank 8 (nickname: Brotha) specialized in medic stuff. The game is really the game of the year for me already (Starcraft II might rock its socks though), the map design is nothing short of perfect and the action just feels great. I just hope DICE doesn&#8217;t pull a second BFH on this and ruin the experience by giving people unfair advantages with payable content.</p>
<p>In other news, I have a lot of unfinished projects (around four) and that&#8217;s not enough! I&#8217;m going to start a new one, this time together with Tom, we&#8217;re still working on the details and hope to start programming soon. I&#8217;m not giving any more information as the whole thing is (as usual) subject to becoming something entirely different over the course of time <img src='http://www.randombase.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.randombase.com/2010/03/update-blah-blah-blah/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Prevent Windows 7 from shutting down your hard drives</title>
		<link>http://www.randombase.com/2010/02/prevent-windows-7-from-shutting-down-your-hard-drives/</link>
		<comments>http://www.randombase.com/2010/02/prevent-windows-7-from-shutting-down-your-hard-drives/#comments</comments>
		<pubDate>Sat, 27 Feb 2010 23:58:19 +0000</pubDate>
		<dc:creator>Iron</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.randombase.com/?p=144</guid>
		<description><![CDATA[This is something I&#8217;ve looked for a little on Google but couldn&#8217;t really find a good answer to this, so I&#8217;ll share the solution here.
The problem is simple: Windows 7 shuts down your extra hard drives after 20 minutes of idling for power saving, this is useful for most people but somehow it annoys the shit out [...]]]></description>
			<content:encoded><![CDATA[<p>This is something I&#8217;ve looked for a little on Google but couldn&#8217;t really find a good answer to this, so I&#8217;ll share the solution here.</p>
<p>The problem is simple: Windows 7 shuts down your extra hard drives after 20 minutes of idling for power saving, this is useful for most people but somehow it annoys the shit out of me &#8211; especially when I&#8217;m listening to music, which is scattered among a couple of my disks. Say every five or six songs my media player freezes for a couple of seconds while Windows fires up a hard drive it shut down earlier.</p>
<p>So, the solution is really simple, there is a setting for this under power management, kind of hidden though. Open up a explorer screen and go to this location:</p>
<p style="padding-left: 30px;"><strong>Control Panel &gt;&gt; All Control Panel Items &gt;&gt; Power Options &gt;&gt;Edit Plan Settings for the plan you are using</strong></p>
<p>Now click on &#8220;Change advanced power settings&#8221; and go to the hard disk menu, change the value of &#8220;Turn off hard disk after&#8221; to 0 minutes, the value will automatically become &#8220;never&#8221;.</p>
<p><a href="http://www.randombase.com/wp-content/uploads/2010/02/shutdown_hdd.png" rel="lightbox[144]"><img class="aligncenter size-medium wp-image-145" title="shutdown_hdd" src="http://www.randombase.com/wp-content/uploads/2010/02/shutdown_hdd-279x300.png" alt="" width="279" height="300" /></a>For those two readers who might be looking for this: you&#8217;re welcome.</p>
<p>I&#8217;ll also take the opportunity to explain why I am using Windows 7 and not a Linux distro like I&#8217;m used to: because the latest generation of Ubuntu/Fedora/Gentoo/etc is a disappointment in every perspective. The whole &#8220;larger public&#8221; approach is probably great for their numbers, but it also brought a lot of goddamn bugs and retarded new-age features that lower the performance Linux had to offer in a previous life. I won&#8217;t go into specifics now, will bring you an enormous article on that later.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.randombase.com/2010/02/prevent-windows-7-from-shutting-down-your-hard-drives/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Thank you Steam, screw you PayPal</title>
		<link>http://www.randombase.com/2010/02/thank-you-steam-screw-you-paypal/</link>
		<comments>http://www.randombase.com/2010/02/thank-you-steam-screw-you-paypal/#comments</comments>
		<pubDate>Fri, 26 Feb 2010 18:46:12 +0000</pubDate>
		<dc:creator>Iron</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.randombase.com/?p=140</guid>
		<description><![CDATA[(this is a follow-up on this previous entry)
I&#8217;ve been mailing back and forth with both PayPal and Steam and if you wonder which one is the most reliable and customer-friendly, then read the rest of the story.
Both parties were very clear from the beginning:
Steam: &#8220;If the account holder is unable or unwilling to drop the [...]]]></description>
			<content:encoded><![CDATA[<p>(this is a follow-up on<a href="http://www.randombase.com/2010/02/thank-you-paypal/"> this previous entry</a>)</p>
<p>I&#8217;ve been mailing back and forth with both PayPal and Steam and if you wonder which one is the most reliable and customer-friendly, then read the rest of the story.</p>
<p>Both parties were very clear from the beginning:</p>
<blockquote><p><strong>Steam:</strong> &#8220;If the account holder is unable or unwilling to drop the dispute and let the PayPal know that the purchase is valid; and in turn have the funds returned to Steam then we will not be able to reactivate the account&#8221;</p></blockquote>
<p>PayPal was too&#8230; oh wait no; they weren&#8217;t:</p>
<blockquote><p>Sometimes, PayPal intercepts payment for investigation. This has happened<br />
with your payment as well. Because PayPal saw this payment as too much risk<br />
to send to the seller, PayPal decided not to let the payment through.<br />
Unfortunately, due to safety reasons and database protection, we cannot<br />
provide you with a clear reason about why the transaction has been<br />
reversed. Our apologies for this inconvenience. You can however try to pay<br />
the seller again.</p></blockquote>
<p>You can read that as: &#8220;Yes, we fucked you over but will never be able to tell you why&#8221;. Say whatever you like but that sounds pretty goddamn random to me. So, PayPal clearly stated later they weren&#8217;t unable (or willing, I&#8217;ll never know) to reopen the dispute or reverse the chargeback so the only direction I was headed was the goodwill of Steam, and boy did I get lucky. I told them how ridiculous the whole case was: how a verified PayPal account that I&#8217;ve been using for years, had seen many thousands of dollars/euros pass by, and never even the slightest dispute, was suddenly selected for review and had a payment reversed. The person from support (wish I had a name for him but it just said &#8220;Support&#8221;, sorry) was <em>very </em>helpful:</p>
<blockquote><p>Hello Giel, I have contacted PayPal directly on your behalf regarding your case. I need to confirm with them that they have verified your account and that the PayPal account was not being used fraudulently. If that is the case I will talk to my supervisor and see if we can make an exception in your case.</p></blockquote>
<p>There&#8217;s a word I love: <strong>exception</strong>. The reply I got today was the best:</p>
<blockquote><p>Hello Giel, I have heard back from PayPal and confirmed your account status with them. Our standard policy is to have PayPal reverse the chargeback before we reactivate your account. Since this is not an option in your case, I have had a discussion with my supervisor and gotten approval to reactivate your account with the expectation that you repurchase the chargedback title within the next 5 days.</p></blockquote>
<p>Needless to say I picked up my credit card and not my goddamn PayPal account and played a long overdue game of Bad Company 2 Beta&#8230; and it still rocks. Can&#8217;t wait for the full release!</p>
<p>Moral of the story is: PayPal is okay, until you get in trouble, they&#8217;re not there to fix it and you&#8217;ll be subject to the goodwill of the other party, in this case the company with the best support: Steam!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.randombase.com/2010/02/thank-you-steam-screw-you-paypal/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>DomainsCreek.com is now offering gift certificates!</title>
		<link>http://www.randombase.com/2010/02/domainscreek-com-is-now-offering-gift-certificates/</link>
		<comments>http://www.randombase.com/2010/02/domainscreek-com-is-now-offering-gift-certificates/#comments</comments>
		<pubDate>Thu, 25 Feb 2010 15:57:24 +0000</pubDate>
		<dc:creator>Iron</dc:creator>
				<category><![CDATA[Project news]]></category>

		<guid isPermaLink="false">http://www.randombase.com/?p=138</guid>
		<description><![CDATA[The first few domain names went already over the counter at DomainsCreek, so we decided to add new things you can buy with your credits: gift certificates! Go to the DomainsCreek store to see if your favorite store is supported, and if it ain&#8217;t please let us know in the comments so we can see [...]]]></description>
			<content:encoded><![CDATA[<p>The first few domain names went already over the counter at <a href="http://www.domainscreek.com" target="_blank">DomainsCreek</a>, so we decided to add new things you can buy with your credits: gift certificates! Go to the <a href="http://www.domainscreek.com/node/9" target="_blank">DomainsCreek store</a> to see if your favorite store is supported, and if it ain&#8217;t please let us know in the comments so we can see what we can do about it!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.randombase.com/2010/02/domainscreek-com-is-now-offering-gift-certificates/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>RandomBase, now XHTML valid!</title>
		<link>http://www.randombase.com/2010/02/randombase-now-xhtml-valid/</link>
		<comments>http://www.randombase.com/2010/02/randombase-now-xhtml-valid/#comments</comments>
		<pubDate>Tue, 23 Feb 2010 18:47:30 +0000</pubDate>
		<dc:creator>Iron</dc:creator>
				<category><![CDATA[RandomBase news]]></category>

		<guid isPermaLink="false">http://www.randombase.com/?p=136</guid>
		<description><![CDATA[Slow news week so here is something really, really lame. I fixed some errors in our frontpage and RandomBase is now XHTML valid! Hooray! What do you think about this standard and does your website follow it? Or is it just another ghost from the past that can be safely ignored as most modern browsers [...]]]></description>
			<content:encoded><![CDATA[<p>Slow news week so here is something really, really lame. I fixed some errors in our frontpage and RandomBase is now <a href="http://validator.w3.org/check?uri=http://randombase.com" target="_blank">XHTML valid</a>! Hooray! What do you think about this standard and does your website follow it? Or is it just another ghost from the past that can be safely ignored as most modern browsers will parse anything?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.randombase.com/2010/02/randombase-now-xhtml-valid/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Google Translate</title>
		<link>http://www.randombase.com/2010/02/google-translate/</link>
		<comments>http://www.randombase.com/2010/02/google-translate/#comments</comments>
		<pubDate>Fri, 19 Feb 2010 20:57:17 +0000</pubDate>
		<dc:creator>Rien</dc:creator>
				<category><![CDATA[RandomBase news]]></category>

		<guid isPermaLink="false">http://www.randombase.com/?p=131</guid>
		<description><![CDATA[Alright, this is going to be my first post over here so don&#8217;t expect too much from it  
I happen to have found something quite interesting yesterday. I read this article about a new function in Google Goggles. It&#8217;s a function which you can best use on your phone. You take a picture of [...]]]></description>
			<content:encoded><![CDATA[<p>Alright, this is going to be my first post over here so don&#8217;t expect too much from it <img src='http://www.randombase.com/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> </p>
<p>I happen to have found something quite interesting yesterday. I read this article about a new function in Google Goggles. It&#8217;s a function which you can best use on your phone. You take a picture of a piece of text (e.g. a menucard) in any language, and it gets instantly translated to the language you choose! In order to do so it uses character recognition, I found it pretty cool. The demonstration can be found <a href="http://www.youtube.com/watch?v=ae01yz5z99E">right here</a>. Right now it&#8217;s just being tested for German -&gt; English but they want to integrate it with all languages from <a href="http://www.translate.google.com">Google Translate</a>.</p>
<p>Google has been working on simultane talk, or whatever they call it. It&#8217;s a function that is supposed to make 2 people speaking 2 completely different languages be able to speak to eachother with instant translation and narration. Something quite like this Google Goggles function. So I wonder, is this another one of Google&#8217;s great ideas?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.randombase.com/2010/02/google-translate/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Thank you PayPal&#8230;</title>
		<link>http://www.randombase.com/2010/02/thank-you-paypal/</link>
		<comments>http://www.randombase.com/2010/02/thank-you-paypal/#comments</comments>
		<pubDate>Thu, 18 Feb 2010 10:55:36 +0000</pubDate>
		<dc:creator>Iron</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.randombase.com/?p=129</guid>
		<description><![CDATA[You read on it, you hear about it, you try to ignore it but when you&#8217;ve been a PayPal user for a long time you&#8217;re bound to encounter one of their famous horrors.This particular horror didn&#8217;t really affect my PayPal account as much as it did my Steam.
Two weeks ago, I bought Battlefield Bad Company [...]]]></description>
			<content:encoded><![CDATA[<p>You read on it, you hear about it, you try to ignore it but when you&#8217;ve been a PayPal user for a long time you&#8217;re bound to encounter one of their famous horrors.This particular horror didn&#8217;t really affect my PayPal account as much as it did my Steam.</p>
<p>Two weeks ago, I bought Battlefield Bad Company 2 (pre-purchase), for some reason PayPal went mental a few minutes after the purchase and locked me out of my account until I changed my password, security question and verified my e-mail half a dozen times again. The payment was marked as &#8220;suspicious&#8221; and went into the resolution center.</p>
<p>I wondered what it was all about, for about a week or so it said &#8220;Waiting for response from vendor&#8221;, and I figured once they said something the whole thing would go away. Well, it didn&#8217;t; yesterday they reversed the payment and I saw in the resolution log they apparently contacted me three times. I checked all possible e-mail accounts, their spam folders, their inboxes, their deleted files, everything. I wasn&#8217;t contacted <em>once</em>.</p>
<p>Obviously Steam isn&#8217;t happy about payments getting reversed, and my account is now fucking disabled; yes, I am extremely unhappy about this. Over the years I bought a lot of Steam games and now they&#8217;re all lost because of one administrative failure. Obviously I opened a ticket at both sides, I&#8217;ll let you guys know the outcome.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.randombase.com/2010/02/thank-you-paypal/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Is Firefox doomed?</title>
		<link>http://www.randombase.com/2010/02/is-firefox-doomed/</link>
		<comments>http://www.randombase.com/2010/02/is-firefox-doomed/#comments</comments>
		<pubDate>Tue, 16 Feb 2010 12:23:27 +0000</pubDate>
		<dc:creator>Iron</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.randombase.com/?p=122</guid>
		<description><![CDATA[Chrome is what it is: damn great. It currently has around 5% of the market (source, source 2) which doesn&#8217;t look like much, well until you see the time it has taken Google to reach this market share: less than two years, and it&#8217;s bound to rise even faster with the recent addition of plug-ins [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.google.com/chrome">Chrome </a>is what it is: <strong>damn great</strong>. It currently has around 5% of the market (<a href="http://marketshare.hitslink.com/report.aspx?qprid=0" target="_blank">source</a>, <a href="http://en.wikipedia.org/wiki/Usage_share_of_web_browsers" target="_blank">source 2</a>) which doesn&#8217;t look like much, well until you see the time it has taken Google to reach this market share: less than two years, and it&#8217;s bound to rise even faster with the recent addition of plug-ins and the overall performance upgrades.</p>
<p>Firefox, once the lightweight version of Mozilla, has become a dinosaur; it puts a great load on your system and has serious issues running on low-end systems while Google Chrome runs like a cheetah on speed, even on the popular net-books. An example; at the moment I am running Firefox with four tabs, memory usage is 187mb. If I open the exact same tabs in Chrome, memory usage is 44mb. That does make a difference on systems with 512mb RAM available.</p>
<p>The overall performance of Chrome basically beats up all the other browsers, big time, remember<a href="http://news.cnet.com/8301-1001_3-10030888-92.html" target="_blank"> the CNET benchmark </a>that probably shocked the developers of all other browsers? Chrome keeps running fine under all circumstances, the only crash I&#8217;ve ever had was in the very beginning, while Firefox does crash sometimes under the load of Javascript.</p>
<p>But obviously Firefox will remain important for quite sometime, but unless they clean up the performance issues and get on the same level as Chrome, they should prepare to be kicked out of the market. My personal opinion on this is quite utopian: Chrome should completely kill all versions of Internet Explorer and share the market with Firefox, so all webdevelopers and designers can sleep at night again, the IE nightmare has taken long enough.</p>
<p>Which browser do you use and why?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.randombase.com/2010/02/is-firefox-doomed/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Just a little update</title>
		<link>http://www.randombase.com/2010/02/just-a-little-update/</link>
		<comments>http://www.randombase.com/2010/02/just-a-little-update/#comments</comments>
		<pubDate>Sun, 14 Feb 2010 20:16:27 +0000</pubDate>
		<dc:creator>Iron</dc:creator>
				<category><![CDATA[Project news]]></category>

		<guid isPermaLink="false">http://www.randombase.com/?p=119</guid>
		<description><![CDATA[(please read this post in a whispering tone as I&#8217;m quite afraid of your feedback since my last post, even though it clearly stated it wasn&#8217;t meant for faster code, but for faster coding and that it were bad practices)
I&#8217;m working on a new project right now, well, not right now (it&#8217;s valentine&#8217;s day and [...]]]></description>
			<content:encoded><![CDATA[<p>(please read this post in a whispering tone as I&#8217;m quite afraid of your feedback since my last post, even though it clearly stated it wasn&#8217;t meant for faster code, but for faster <em>coding </em>and that it were <em>bad </em>practices)</p>
<p>I&#8217;m working on a new project right now, well, not right now (it&#8217;s valentine&#8217;s day and my girl will be here in a second <img src='http://www.randombase.com/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> ). I bought a really nice domain for it and everything, I&#8217;m hoping to release it this week if everything works out well. It&#8217;ll be handy for everyone who downloads movies or tv episodes from time to time, that&#8217;s all I&#8217;m saying at this point.</p>
<p>Have a nice cliché holiday guys and if you do not have anyone to celebrate it with, a bottle of vodka should help you out.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.randombase.com/2010/02/just-a-little-update/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Writing shorter PHP code</title>
		<link>http://www.randombase.com/2010/02/writing-shorter-php-code/</link>
		<comments>http://www.randombase.com/2010/02/writing-shorter-php-code/#comments</comments>
		<pubDate>Thu, 11 Feb 2010 19:13:03 +0000</pubDate>
		<dc:creator>Iron</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.randombase.com/?p=111</guid>
		<description><![CDATA[Long post ahead! I&#8217;m going to give a few examples I use in my PHP code, mainly when it&#8217;s not intended to be viewed by many people or just to confuse the hell out of my teachers (it&#8217;s not very nice on the eye). Click read more to continue reading&#8230;
Shortening if() questions
If you are a [...]]]></description>
			<content:encoded><![CDATA[<p>Long post ahead! I&#8217;m going to give a few examples I use in my PHP code, mainly when it&#8217;s not intended to be viewed by many people or just to confuse the hell out of my teachers (it&#8217;s not very nice on the eye). Click read more to continue reading&#8230;</p>
<h2><span id="more-111"></span>Shortening if() questions</h2>
<p>If you are a normal PHP programmer, an if() question looks like this:</p>
<blockquote><p>if($variable == 2)</p>
<p>{</p>
<p style="padding-left: 30px;">$is_two = true;</p>
<p>}</p>
<p>else</p>
<p>{</p>
<p style="padding-left: 30px;">$is_two = false;</p>
<p>}</p></blockquote>
<p>That&#8217;s easy, but took up quite some space. You can do that in one line, like this:</p>
<blockquote><p>$is_two = ($variable == 2) ? true : false;</p></blockquote>
<p>That&#8217;s as easy as it gets. Another example:</p>
<blockquote><p>$color = ($is_white) ? &#8216;#FFFFFF&#8217; : &#8216;#000000&#8242;;</p></blockquote>
<p>Easy enough! But you can make it even more horrible on the eyes:</p>
<blockquote><p>$text = (empty($_GET['text'])) ? &#8216; &#8216; : ((strlen($_GET['text']) &lt; 50) ? $_GET['text'] : substr($_GET['text'],0,49));</p></blockquote>
<p>(and all it does is just shorten your text to 50 characters when it exceeds this limit&#8230;)</p>
<h2>Declaring many variables</h2>
<p>This is probably a bad practice, but I use it quite a lot. This might be something like your code in the first few lines:</p>
<blockquote><p>$do_something = false;</p>
<p>$do_nothing = true;</p>
<p>$visit_randombase = &#8220;Yep&#8221;;</p></blockquote>
<p>All good, but that could have happened in one line too:</p>
<blockquote><p>list($do_something,$do_nothing,$visit_randombase) = array(false,true,&#8217;Yep&#8217;);</p></blockquote>
<p>Or if you are declaring variables that all have the same value, simply do:</p>
<blockquote><p>$var1 = $var2 = $var3 = &#8220;Hello world!&#8221;;</p></blockquote>
<p>This&#8217;ll simply put all variables as &#8220;Hello world!&#8221;.</p>
<h2>Use switch() instead of if()</h2>
<p>This is just basic PHP, but gets often overlooked. A common piece of PHP code:</p>
<blockquote><p>if($option == &#8220;menu&#8221;)</p>
<p>{</p>
<p>//load menu</p>
<p>}</p>
<p>elseif($option == &#8220;home&#8221;)</p>
<p>{</p>
<p>//load home</p>
<p>}</p>
<p>else</p>
<p>{</p>
<p>//load empty</p>
<p>}</p></blockquote>
<p>Looks familiar? Using switch() could have made shorter and way nicer PHP code:</p>
<blockquote><p>switch($option)</p>
<p>{</p>
<p>case &#8216;menu&#8217;:</p>
<p>//load menu</p>
<p>break;</p>
<p>case &#8216;home&#8217;:</p>
<p>//load home</p>
<p>break;</p>
<p>default:</p>
<p>//load empty</p>
<p>}</p></blockquote>
<p>(seems like my example isn&#8217;t that much shorter&#8230; but it is in many situations <img src='http://www.randombase.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  )</p>
<p>This is it for now, three simple tricks to shorten your programming code and make it lighter (both in filesize and server load). There are many more and I&#8217;ll be writing about more tricks later, but these were the first to pop in my head for now. Please know I am in no way some certified PHP professional or anything, so mistakes in the code are possible, or some stuff could have been done even shorter. I love to learn so read &#8216;n comment already!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.randombase.com/2010/02/writing-shorter-php-code/feed/</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.529 seconds -->
<!-- Cached page served by WP-Cache -->
