<?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>NewSourceMedia Blog &#187; Tutorials</title>
	<atom:link href="http://newsourcemedia.com/blog/category/php/tutorials/feed/" rel="self" type="application/rss+xml" />
	<link>http://newsourcemedia.com/blog</link>
	<description>Focused on Interactive Design, Development and Marketing</description>
	<lastBuildDate>Fri, 30 Dec 2011 04:30:03 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Sort Directory Listings</title>
		<link>http://newsourcemedia.com/blog/sort-directory-listings/</link>
		<comments>http://newsourcemedia.com/blog/sort-directory-listings/#comments</comments>
		<pubDate>Tue, 02 Dec 2003 00:22:11 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[CMS]]></category>
		<category><![CDATA[Files and Folders]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://newsourcemedia.com/blog/1969/12/31/sort-directory-listings/</guid>
		<description><![CDATA[Here is some code to help sort the order of your directory output. This is greate for creating PHP FTP applications. sort() General Example 1. $fruits = array("lemon", "orange", "banana", "apple"); sort($fruits); reset($fruits); while (list($key, $val) = each($fruits)) { echo &#8230; <a href="http://newsourcemedia.com/blog/sort-directory-listings/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[Here is some code to help sort the order of your directory output. This is greate for creating PHP FTP applications.
<span id="more-236"></span>

<strong> <span style="color: #006600; font-size: large;">sort()</span></strong>

<strong>General Example 1.</strong>

<span style="color: #ff6600;"> $fruits = array("lemon", "orange", "banana", "apple");
sort($fruits);
reset($fruits);
while (list($key, $val) = each($fruits)) {
echo "fruits[".$key."] = ".$val."\n";
}
?&gt;</span>

<strong>Directory Example 1. A simple scandir() example</strong>

<span style="color: #ff6600;"> $dir = '/tmp';
$files1 = scandir($dir);
$files2 = scandir($dir, 1);
print_r($files1);
print_r($files2);</span>
<span style="color: #666666;">/* Outputs something like:
Array
(
[0] =&gt; .
[1] =&gt; ..
[2] =&gt; bar.php
[3] =&gt; foo.txt
[4] =&gt; somedir
)
Array
(
[0] =&gt; somedir
[1] =&gt; foo.txt
[2] =&gt; bar.php
[3] =&gt; ..
[4] =&gt; .
)
*/</span>
<span style="color: #ff6600;">?&gt;</span>

<strong>Directory Example 2. PHP 4 alternatives to scandir()</strong>

<span style="color: #ff6600;"> $dir = "/tmp";
$dh = opendir($dir);
while (false !== ($filename = readdir($dh))) {
$files[] = $filename;
}
sort($files);
print_r($files);
rsort($files);
print_r($files);</span>
<span style="color: #666666;">/* Outputs something like:
Array
(
[0] =&gt; .
[1] =&gt; ..
[2] =&gt; bar.php
[3] =&gt; foo.txt
[4] =&gt; somedir
)
Array
(
[0] =&gt; somedir
[1] =&gt; foo.txt
[2] =&gt; bar.php
[3] =&gt; ..
[4] =&gt; .
)
*/</span>
<span style="color: #ff6600;">?&gt; </span>]]></content:encoded>
			<wfw:commentRss>http://newsourcemedia.com/blog/sort-directory-listings/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>PHP Lesson 2 &#8211; Add Comments</title>
		<link>http://newsourcemedia.com/blog/php-lesson-2-add-comments/</link>
		<comments>http://newsourcemedia.com/blog/php-lesson-2-add-comments/#comments</comments>
		<pubDate>Mon, 02 May 2005 00:22:11 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Beginner]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[beginner]]></category>
		<category><![CDATA[clean up]]></category>
		<category><![CDATA[comments.]]></category>
		<category><![CDATA[easy lesson]]></category>
		<category><![CDATA[first time]]></category>
		<category><![CDATA[new to php]]></category>
		<category><![CDATA[organize]]></category>
		<category><![CDATA[php scripts]]></category>
		<category><![CDATA[web page]]></category>

		<guid isPermaLink="false">http://newsourcemedia.com/blog/2005/05/01/php-lesson-2-add-comments/</guid>
		<description><![CDATA[You will save a lot of time and money if you just remember to write comments as you write your codes. Trust me, you will forget which code goes where and what it does. We all forget. This is a &#8230; <a href="http://newsourcemedia.com/blog/php-lesson-2-add-comments/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[You will save a lot of time and money if you just remember to write comments as you write your codes. Trust me, you will forget which code goes where and what it does. We all forget. This is a how-to on how to organize your scripts with different types of
<span id="more-256"></span>

<span style="font-family: Verdana,Arial,Helvetica,sans-serif;"><strong>Introduction</strong></span>

<span style="font-family: Verdana,Arial,Helvetica,sans-serif;">In this tutorial    you will learn how to organize your PHP script using comments. You may feel it’s    unnecessary to write comments in your code; however, comments can save you a    great deal of time and money plus help you and other programmers understand your code    for future revisions.</span>

If you have not read part one, please do and if you are not working on a php server, we recommend <a href="http://www.simplehost.com/cgi/clickthru.cgi?id=alexmcleaniii">SimpleHost.com</a> for only $7.50 with Unlimited Disk Space, Subdomains, and Emails Accounts.

<span style="font-family: Verdana,Arial,Helvetica,sans-serif;"><strong>
PHP Comment Examples</strong></span>

<span style="font-family: Verdana,Arial,Helvetica,sans-serif;">For a single line    comment use "two forward slashes" (//) or a "hash sign"    (#) like this:

<span style="color: #ff9900;">// This is a single line comment.</span>

<span style="color: #ff9900;"># This is also a single line comment.
</span>
Multiple line comments start with a forward slash with an asterisk (/*) and    ends with an asterisk with a forward slash (*/) like this:

<span style="color: #ff9900;">/*
This is a multiple line comment.
Just remember that the asterisks are always placed on the inside of the combinations.
*/</span>
<strong><span style="font-family: Verdana;">Combining PHP with HTML Comment Tags</span></strong></span>

<span style="font-family: Verdana,Arial,Helvetica,sans-serif;">PHP comments,    as well as PHP codes are not viewable in the browser window, nor will you find    them inside the browser's view HTML source code. In order to view comments in    the browser's view HTML source code, you must create comments using HTML comment    tags.</span>

<span style="font-family: Verdana,Arial,Helvetica,sans-serif;">An HTML Comment    tag starts with a less-than sign, exclamation sign and a few dashes (&lt;!--)    and end with a few dashes with a greater-than sign (--&gt;). Here are examples    of combining PHP with HTML comments:

<span style="color: #009900;">&lt;?
echo “My name”;
?&gt;
<span style="color: #ff9900;">&lt;!-- this is an html comment --&gt;</span>
&lt;?
echo “is Alex!”
?&gt;</span>

<strong>Note:
</strong>In the code above I used three blocks of code. The beginning and last blocks    were PHP and the middle block was an HTML Comment.

You can also have PHP output the HTML comment like this:

<span style="color: #009900;">&lt;?
echo “My name &lt;!-- this is a html comment --&gt; is Alex!”;
?&gt;</span>

PHP will output this to the browser:

</span><span style="font-family: Courier New,Courier,mono;"> My name is Alex!</span><span style="font-family: Verdana,Arial,Helvetica,sans-serif;">

The source html code view will look like this:

<span style="color: #ff00ff;">My name <span style="color: #ff9900;">&lt;!-- this is an html    comment --&gt;</span> is Alex!</span>
<strong>Summary</strong></span>

<span style="font-family: Verdana,Arial,Helvetica,sans-serif;">
If you have any questions, please search or post a question to the forum. You    may also want to check out a few of the books listed below.

Books:
<a href="http://www.amazon.com/exec/obidos/ASIN/1861006918/newsourcemedi-20">Professional PHP4 Programming </a>
<a href="http://www.amazon.com/exec/obidos/ASIN/0672317842/newsourcemedi-20">PHP  and MySQL Web Development</a><a href="http://www.amazon.com/exec/obidos/ASIN/0672317842/newsourcemedi-20">
</a> </span>]]></content:encoded>
			<wfw:commentRss>http://newsourcemedia.com/blog/php-lesson-2-add-comments/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->
