<?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; php scripts</title>
	<atom:link href="http://newsourcemedia.com/blog/tag/php-scripts/feed/" rel="self" type="application/rss+xml" />
	<link>http://newsourcemedia.com/blog</link>
	<description>Focused on Interactive Design, Development and Marketing</description>
	<lastBuildDate>Wed, 11 Aug 2010 13:56:31 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<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 how-to on how to organize your scripts with different types of

Introduction
In this tutorial   [...]]]></description>
			<content:encoded><![CDATA[<p>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<br />
<span id="more-256"></span></p>
<p><span style="font-family: Verdana,Arial,Helvetica,sans-serif;"><strong>Introduction</strong></span></p>
<p><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></p>
<p>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.</p>
<p><span style="font-family: Verdana,Arial,Helvetica,sans-serif;"><strong><br />
PHP Comment Examples</strong></span></p>
<p><span style="font-family: Verdana,Arial,Helvetica,sans-serif;">For a single line    comment use &#8220;two forward slashes&#8221; (//) or a &#8220;hash sign&#8221;    (#) like this:</p>
<p><span style="color: #ff9900;">// This is a single line comment.</span></p>
<p><span style="color: #ff9900;"># This is also a single line comment.<br />
</span><br />
Multiple line comments start with a forward slash with an asterisk (/*) and    ends with an asterisk with a forward slash (*/) like this:</p>
<p><span style="color: #ff9900;">/*<br />
This is a multiple line comment.<br />
Just remember that the asterisks are always placed on the inside of the combinations.<br />
*/</span><br />
<strong><span style="font-family: Verdana;">Combining PHP with HTML Comment Tags</span></strong></span></p>
<p><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&#8217;s view HTML source code. In order to view comments in    the browser&#8217;s view HTML source code, you must create comments using HTML comment    tags.</span></p>
<p><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;!&#8211;)    and end with a few dashes with a greater-than sign (&#8211;&gt;). Here are examples    of combining PHP with HTML comments:</p>
<p><span style="color: #009900;">&lt;?<br />
echo “My name”;<br />
?&gt;<br />
<span style="color: #ff9900;">&lt;!&#8211; this is an html comment &#8211;&gt;</span><br />
&lt;?<br />
echo “is Alex!”<br />
?&gt;</span></p>
<p><strong>Note:<br />
</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.</p>
<p>You can also have PHP output the HTML comment like this:</p>
<p><span style="color: #009900;">&lt;?<br />
echo “My name &lt;!&#8211; this is a html comment &#8211;&gt; is Alex!”;<br />
?&gt;</span></p>
<p>PHP will output this to the browser:</p>
<p></span><span style="font-family: Courier New,Courier,mono;"> My name is Alex!</span><span style="font-family: Verdana,Arial,Helvetica,sans-serif;"></p>
<p>The source html code view will look like this:</p>
<p><span style="color: #ff00ff;">My name <span style="color: #ff9900;">&lt;!&#8211; this is an html    comment &#8211;&gt;</span> is Alex!</span><br />
<strong>Summary</strong></span></p>
<p><span style="font-family: Verdana,Arial,Helvetica,sans-serif;"><br />
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.</p>
<p>Books:<br />
<a href="http://www.amazon.com/exec/obidos/ASIN/1861006918/newsourcemedi-20">Professional PHP4 Programming </a><br />
<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"><br />
</a> </span></p>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://newsourcemedia.com/blog/popup-chromeless-window/" rel="bookmark">Popup Chromeless Window</a></li><li><a href="http://newsourcemedia.com/blog/php-lesson-1-first-php-script/" rel="bookmark">PHP Lesson 1 - First PHP Script</a></li><li><a href="http://newsourcemedia.com/blog/prevent-crawling-and-site-indexing/" rel="bookmark">Prevent Crawling and Site Indexing</a></li><li><a href="http://newsourcemedia.com/blog/php-email-form-easy/" rel="bookmark">PHP Email Form Easy</a></li><li><a href="http://newsourcemedia.com/blog/basic-terminal-commands/" rel="bookmark">Basic Terminal Commands</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://newsourcemedia.com/blog/php-lesson-2-add-comments/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP Lesson 1 &#8211; First PHP Script</title>
		<link>http://newsourcemedia.com/blog/php-lesson-1-first-php-script/</link>
		<comments>http://newsourcemedia.com/blog/php-lesson-1-first-php-script/#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[beginner]]></category>
		<category><![CDATA[easy lesson]]></category>
		<category><![CDATA[first time]]></category>
		<category><![CDATA[new to php]]></category>
		<category><![CDATA[php scripts]]></category>
		<category><![CDATA[web page]]></category>

		<guid isPermaLink="false">http://newsourcemedia.com/blog/2005/05/01/php-lesson-1-first-php-script/</guid>
		<description><![CDATA[If you are new to PHP, this is for you. Here you will learn how to create and run a PHP web page for the first time.

Introduction
In this tutorial you will learn how to run a PHP script.
Open a text editor application. Be sure to use a simple text editor, nothing    like [...]]]></description>
			<content:encoded><![CDATA[<p>If you are new to PHP, this is for you. Here you will learn how to create and run a PHP web page for the first time.<br />
<span id="more-257"></span></p>
<p><span style="font-family: Verdana,Arial,Helvetica,sans-serif;"><strong>Introduction</strong></span></p>
<p><strong></strong>In this tutorial you will learn how to run a PHP script.</p>
<p>Open a text editor application. Be sure to use a simple text editor, nothing    like MS Word because a big text programs will add extra characters and bugs    to your code.<br />
<span style="font-size: xx-small;">Advertisement</span><br />
<a href="http://www.hotscripts.com/?RID=147086"><img src="http://images.hotscripts.com/static/1.gif" border="0" alt="" /></a></p>
<p>In order to run PHP, you are going to need a web server with PHP installed. We recommend <a href="http://partners.ipower.com/z/10/CD1212/">iPowerWeb.com</a> for only $7.50 with Unlimited Disk Space, Subdomains, and Emails Accounts.    Another requirement for running PHP scripts on a server is the extension file    name format. By default you must use a &#8220;.php&#8221; extension on your PHP web page    files. Other extensions that may work depending on you server are &#8220;.php3&#8243; and    &#8220;.php4&#8243;.</p>
<p>O. K. Let&#8217;s start on our first script. To begin a block of PHP statements we    need to start it with a PHP open tag:</p>
<p><span style="color: #006600;"> &lt;?php</span></p>
<p>or</p>
<p><span style="color: #006600;"> &lt;?</span></p>
<p>And now we end our code with a closer tag:</p>
<p><span style="color: #006600;">?&gt; </span></p>
<p>Lets create a new file and name it &#8220;first.php&#8221;. Type the code below (or copy    and past it) in to the file named &#8220;first.php&#8221; and upload it to your server:</p>
<p><span style="color: #006600;"> &lt;?php<br />
print &#8220;Hello World!&#8221;;<br />
?&gt; </span></p>
<p>Now access the url page through the browser to see the out put. It should read:</p>
<p>Hello World!</p>
<p>Note that if you view the source html code from the browser application, all    php code is hidden. It was all parsed (processed) before the browser application    could view the page.<br />
<strong>Structure</strong></p>
<p>You can structure the PHP code all on one line if you prefer like this:</p>
<p><span style="color: #006600;">&lt;?php print &#8220;Hello World!&#8221;; ?&gt;</span></p>
<p>You can also use the short start tag &#8221; &lt;?&#8221; with out the &#8220;&lt;?php&#8221; like this:</p>
<p><span style="color: #006600;">&lt;? print &#8220;Hello World!; ?&gt; </span></p>
<p>You can also change the &#8220;print&#8221; function to &#8220;echo&#8221; or &#8220;return&#8221; functions and    achieve the same results like this:</p>
<p><span style="color: #006600;">&lt;? echo &#8220;Hello World!&#8221;; ?&gt;</span><br />
or<br />
<span style="color: #006600;"> &lt;? return &#8220;Hello World!&#8221;; ?&gt; </span></p>
<p>You can also combine HTML and PHP all in one page like this:</p>
<p><span style="color: #006600;"> <span style="color: #666666;">&lt;HTML&gt;<br />
&lt;HEAD&gt;<br />
&lt;TITLE&gt;newsourcemedia.com&lt;/title&gt;<br />
&lt;META http-equiv=&#8221;Content-Type&#8221; content=&#8221;text/html; charset=iso-8859-1&#8243;&gt;<br />
&lt;/head&gt;<br />
&lt;BODY&gt;</span><br />
&lt;? return &#8220;Hello World!&#8221;; ?&gt;<br />
<span style="color: #666666;">&lt;/body&gt;<br />
&lt;/html&gt; </span><br />
</span></p>
<p><span style="font-family: Verdana,Arial,Helvetica,sans-serif;">You can also use    more then on line for the string of data like this:</span></p>
<p><span style="font-family: Verdana,Arial,Helvetica,sans-serif; color: #006600;">&lt;?<br />
print &#8220;Hello<br />
World!&#8221;;<br />
?&gt;</span></p>
<p><span style="font-family: Verdana,Arial,Helvetica,sans-serif;">or</span></p>
<p><span style="font-family: Verdana,Arial,Helvetica,sans-serif; color: #006600;">&lt;?<br />
print &#8221;<br />
Hello<br />
World<br />
&#8220;;<br />
?&gt; </span></p>
<p>Tryout some of these above samples. You can also change the statement inside    the quotes if you like to see if all still goes well.<br />
<strong>Understanding the Code<br />
</strong><br />
Let take a look at how the code works. We already know from above that &#8220;&lt;?&#8221;    and &#8220;?&gt;&#8221; are the start and end PHP tags. Next we used three deferent    word: &#8220;print&#8221;, &#8220;echo&#8221; and &#8220;return&#8221;. These word    commands are built-in PHP <strong><em>Functions</em></strong> that outputs data (you&#8217;ll    learn soon how to build your own functions).</p>
<p>A <strong><em>Function</em></strong> is a command that performs an action and is modified    by other data usually supplied to it. The data ( a collections of characters    or a &#8220;string&#8221;) is usually always placed inside single or double quotes.    Most functions must have parentheses after their name like function( ). However    the three functions we have use above are exempted from that role.</p>
<p>Lastly, we used a semicolon &#8220;;&#8221;. The semicolon tell PHP that this is the    end of the line of code and to execute this line of code.</p>
<p>Most programmers forget to end there code with the semicolon. You will find    that most of the reasons for your codes not working properly is that you forgot    as well.<br />
<strong> Summary</strong></p>
<p><strong></strong>In this tutorial you learned how to use a text editor to create a PHP script,    how to name your PHP files, how to start and end blocks of code with start and    end tags, how to output data to the browser with functions, and how to combine    PHP and HTML codes.</p>
<p>This is just the tip of the iceberg so be sure to <a href="../../index.php?ref_main=PHP&amp;searchstring=Tutorials">click here to check out our other tutorials on PHP</a>.</p>
<p><!--   Start of HTML Code   ---></p>
<table border="1" cellspacing="0" cellpadding="4" width="250" bgcolor="#d70500" bordercolor="#840300">
<form action="http://www.hotscripts.com/cgi-bin/rate.cgi" method="post">
<tbody>
<tr>
<td>
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tbody>
<tr>
<td><strong><span style="font-family: Verdana,Arial; color: #ffffff; font-size: xx-small;">If you like our  script, please rate it!</span></strong><br />
<input name="ID" type="hidden" value="25875" />
<input name="external" type="hidden" value="1" /></td>
</tr>
<tr>
<td>
<select name="rate" size="1"> <option selected="selected" value="5">Excellent!</option> <option value="4">Very Good</option> <option value="3">Good</option> <option value="2">Fair</option> <option value="1">Poor</option> </select>
<input name="submit" type="submit" value="Cast My Vote!" /></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</form>
</table>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://newsourcemedia.com/blog/php-email-form-easy/" rel="bookmark">PHP Email Form Easy</a></li><li><a href="http://newsourcemedia.com/blog/php-lesson-2-add-comments/" rel="bookmark">PHP Lesson 2 - Add Comments</a></li><li><a href="http://newsourcemedia.com/blog/popup-chromeless-window/" rel="bookmark">Popup Chromeless Window</a></li><li><a href="http://newsourcemedia.com/blog/basic-terminal-commands/" rel="bookmark">Basic Terminal Commands</a></li><li><a href="http://newsourcemedia.com/blog/php-remove-non-alphanumeric-characters/" rel="bookmark">Php Remove Non-Alphanumeric Characters</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://newsourcemedia.com/blog/php-lesson-1-first-php-script/feed/</wfw:commentRss>
		<slash:comments>6</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! -->