<?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>WhyPad &#187; PHP</title>
	<atom:link href="http://www.whypad.com/tag/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.whypad.com</link>
	<description>Tips, tricks, and hacks for life and tech...</description>
	<lastBuildDate>Tue, 06 Jul 2010 15:21:22 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>OOP PHP:  What is the Double Colon in Objects/Classes for?</title>
		<link>http://www.whypad.com/posts/php-using-the-double-colon/500/</link>
		<comments>http://www.whypad.com/posts/php-using-the-double-colon/500/#comments</comments>
		<pubDate>Fri, 16 Jan 2009 21:26:03 +0000</pubDate>
		<dc:creator>Byron Bennett</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[web dev]]></category>

		<guid isPermaLink="false">http://www.whypad.com/?p=500</guid>
		<description><![CDATA[I happen to be the only PHP programmer that I know, so it&#8217;s hard to ask your buddy what the heck that :: is used for in some OO PHP programs.  I know you could post it on a forum and get the answer, but I never did.  And Google wasn&#8217;t really forth coming when [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.whypad.com/wp-content/uploads/php.gif" alt="php" title="php" width="120" height="67" class="alignleft size-full wp-image-502" />I happen to be the only PHP programmer that I know, so it&#8217;s hard to ask your buddy what the heck that :: is used for in some OO PHP programs.  I know you could post it on a forum and get the answer, but I never did.  And Google wasn&#8217;t really forth coming when you put :: in a search.  Finally I found it in the PHP documentation:  check out <a href="http://us.php.net/manual/en/language.oop5.paamayim-nekudotayim.php">Scope Resolution Operator (::)</a>.  In short, it&#8217;s used to access Static or Constant members of a class.  Here&#8217;s a brief example:</p>
<p><span id="more-500"></span></p>
<pre class="brush: php;"> class DatabaseConnector {
   const CONNECTION_STRING = 'myconnectionstring';
}

//Referece that connection string constant like so...
DatabaseConnector::CONNECTION_STRING;
</pre>
<p>So there you go, mystery solved <img src='http://www.whypad.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p>In case you&#8217;re wondering what the :: is called, it&#8217;s a Paamayim Nekudotayim, which is Hebrew for the cryptic phrase: double colon!</p>
<p>Cheers,<br />
Byron</p>
<img src="http://www.whypad.com/?ak_action=api_record_view&id=500&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.whypad.com/posts/php-using-the-double-colon/500/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>ASP.Net C# &#8211; PHP  Equivalents</title>
		<link>http://www.whypad.com/posts/aspnet-c-sharp-php-equivalents/263/</link>
		<comments>http://www.whypad.com/posts/aspnet-c-sharp-php-equivalents/263/#comments</comments>
		<pubDate>Wed, 17 Sep 2008 21:05:36 +0000</pubDate>
		<dc:creator>Byron Bennett</dc:creator>
				<category><![CDATA[ASP.NET/C#]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.whypad.com/?p=263</guid>
		<description><![CDATA[On this post, I will be collecting ASP.NET C# commands that I use frequently in PHP but I have to continually look up in the little bit of ASP.NET that I do.  PHP can be frustrating for its inconsistencies in syntax, but what is even more frustrating is when you&#8217;re trying to do something in [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignright size-full wp-image-451" title="ASP.net" src="http://www.whypad.com/wp-content/uploads/logo.png" alt="ASP.net" width="108" height="44" /><img class="alignnone size-full wp-image-450" title="php_snow_2008" src="http://www.whypad.com/wp-content/uploads/php_snow_2008.gif" alt="php_snow_2008" width="120" height="64" /></p>
<p><span id="more-263"></span></p>
<p>On this post, I will be collecting ASP.NET C# commands that I use frequently in PHP but I have to continually look up in the little bit of ASP.NET that I do.  PHP can be frustrating for its inconsistencies in syntax, but what is even more frustrating is when you&#8217;re trying to do something in C# and you&#8217;re trying to remember whether the common sense syntax is in PHP or C#&#8230;This tries to be a cheat sheet for those for me:</p>
<table border="2" cellspacing="2" cellpadding="2">
<tbody>
<tr>
<td width="50%"><strong>PHP</strong></td>
<td width="50%"><strong>ASP.net</strong></td>
</tr>
<tr>
<td>echo &#8216;string&#8217;;</td>
<td>Response.Write(&#8220;the_text_goes_here&#8221;);</td>
</tr>
<tr>
<td>$_REQUEST['parameter_name'];</td>
<td>Request.QueryString["parameter_name"];</td>
</tr>
<tr>
<td>urlencode( <em>string</em> );</td>
<td>Server.UrlEncode( <em>string</em> );</td>
</tr>
<tr>
<td><strong>Convert unix timestamp:</strong>date(&#8220;m.d.y&#8221;, $timestamp);</td>
<td>public static System.DateTime UnixToDotNet(int unixTimestamp)<br />
{<br />
System.DateTime date = System.DateTime.Parse(&#8220;1/1/1970&#8243;);<br />
return date.AddSeconds(unixTimestamp);<br />
}</td>
</tr>
<tr>
<td><strong>Connection string:</strong><br />
mysql_connect([string $server [,string $username [, string $password [,bool $new_link [, int $client_flags ]]]]] )</td>
<td><strong>Code for using conn string in Web.config:</strong></p>
<pre class="csharpcode"><span class="kwrd">string</span> dbConn = System.Configuration.ConfigurationManager.ConnectionStrings[<span class="str">"QueryStringName"</span>].ToString();</pre>
</td>
</tr>
</tbody>
</table>
<img src="http://www.whypad.com/?ak_action=api_record_view&id=263&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.whypad.com/posts/aspnet-c-sharp-php-equivalents/263/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP: Using Switch to test Multiple Conditions</title>
		<link>http://www.whypad.com/posts/php-using-switch-to-test-multiple-conditions/210/</link>
		<comments>http://www.whypad.com/posts/php-using-switch-to-test-multiple-conditions/210/#comments</comments>
		<pubDate>Mon, 04 Aug 2008 03:41:10 +0000</pubDate>
		<dc:creator>Byron Bennett</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[web dev]]></category>

		<guid isPermaLink="false">http://www.whypad.com/?p=210</guid>
		<description><![CDATA[Ok, so maybe this is common knowledge, but I still felt a little clever when I figured out this trick.  The situation was that I wanted to test a bunch of different conditions to figure out which time category a date falls into.  It would be fairly simple to do with a bunch of if&#8230;then&#8230;else&#8217;s, [...]]]></description>
			<content:encoded><![CDATA[<p>Ok, so maybe this is common knowledge, but I still felt a little clever when I figured out this trick.  The situation was that I wanted to test a bunch of different conditions to figure out which time category a date falls into.  It would be fairly simple to do with a bunch of if&#8230;then&#8230;else&#8217;s, but really ugly.  Here&#8217;s the trick I came up with&#8230;use   switch(true), and then set up your cases to evaluate to true or false.  Here&#8217;s some example code:</p>
<p><span id="more-210"></span></p>
<pre>

$mymd = date('Ymd', $row->date_due);
$tymd = date('Ymd');  //Today

switch (true) {
	case $mymd == $tymd :
		$ind = "today";
		break;
	case $mymd < $tymd :
		$ind = "overdue";
		break;
	case $mymd < ($tymd + (6 - date('w'))) :
		$ind = "restofweek";
		break;
	default :
		$ind = (int) date('Ym',$row['duedate']);
		break;
}
</pre>
<img src="http://www.whypad.com/?ak_action=api_record_view&id=210&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.whypad.com/posts/php-using-switch-to-test-multiple-conditions/210/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
