<?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>Blogternals &#187; comment</title>
	<atom:link href="http://www.blogternals.com/tag/comment/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.blogternals.com</link>
	<description>Knowledge Belongs to the World!</description>
	<lastBuildDate>Wed, 11 Aug 2010 12:32:12 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>Adding a Comment to a PHP Code Page</title>
		<link>http://www.blogternals.com/2009/06/04/adding-a-comment-to-a-php-code-page/</link>
		<comments>http://www.blogternals.com/2009/06/04/adding-a-comment-to-a-php-code-page/#comments</comments>
		<pubDate>Thu, 04 Jun 2009 12:24:17 +0000</pubDate>
		<dc:creator>Allen Sanford</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[comment]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://www.blogternals.com/?p=574</guid>
		<description><![CDATA[Comments are actually the most important thing any coder can learn to properly use. There are actually a few different styles to use when commenting code for PHP. In this tutorial I am mostly going to let the code do the speaking &#8230; so to speak &#8230;?! Any way. Let me get a few important [...]]]></description>
			<content:encoded><![CDATA[<p>Comments are actually the most important thing any coder can learn to properly use. There are actually a few different styles to use when commenting code for PHP. In this tutorial I am mostly going to let the code do the speaking &#8230; so to speak &#8230;?! Any way. Let me get a few important things out of they way first. The PHP interpreter ignores comments so you can only gain an advantage by adding then. Six months or a year down the road their usefulness out weights the trouble of adding them to your code. And lastly you can put your contact information in the comments of your code so when you pass you code out as open source somebody will notice that you wrote it. OH yeah I forgot to mention you can use them to debug code as well.</p>
<p><span id="more-574"></span></p>
<p>First style that you will see is in line or single line comments and they can be used two ways.</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left2">Download <a href="http://www.blogternals.com/wp-content/plugins/wp-codebox/wp-codebox.php?p=574&amp;download=example.php">example.php</a></span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p5744"><td class="line_numbers"><pre>42
43
44
45
46
</pre></td><td class="code" id="p574code4"><pre class="php" style="font-family:monospace;">&nbsp;
    <span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$rows</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$row</span><span style="color: #009900;">&#41;</span> <span style="color: #666666; font-style: italic;">// This loops through every row of rows</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #666666; font-style: italic;">// TODO: Implement something cool here</span>
    <span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>Second style is to use multi-line comments, this is used by the famous phpDocumentor project.</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left2">Download <a href="http://www.blogternals.com/wp-content/plugins/wp-codebox/wp-codebox.php?p=574&amp;download=example.php">example.php</a></span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p5745"><td class="line_numbers"><pre>42
43
44
45
46
47
48
49
50
51
52
53
</pre></td><td class="code" id="p574code5"><pre class="php" style="font-family:monospace;">&nbsp;
    <span style="color: #666666; font-style: italic;">/*
        I know that I want to implement this loop later
        but I don't want to run a loop that does nothing
        either so for know I am going to comment out
        all of this.
        Cool!
        foreach ($rows as $row)
        {
            // TODO: Implement something cool here
        }
    */</span></pre></td></tr></table></div>

<p>Third style is the less familiar but oh so useful if stament comment. Allowing you to wrap large blocks of code with an if statement to comment it out.</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left2">Download <a href="http://www.blogternals.com/wp-content/plugins/wp-codebox/wp-codebox.php?p=574&amp;download=example.php">example.php</a></span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p5746"><td class="line_numbers"><pre>42
43
44
45
46
47
48
49
</pre></td><td class="code" id="p574code6"><pre class="php" style="font-family:monospace;">&nbsp;
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #666666; font-style: italic;">// This will skip this block of code thereby not executing a loop that does nothing</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$rows</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$row</span><span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#123;</span>
            <span style="color: #666666; font-style: italic;">// TODO: Implement something cool here</span>
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span> <span style="color: #666666; font-style: italic;">// End if (0)</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.blogternals.com/2009/06/04/adding-a-comment-to-a-php-code-page/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
