<?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>HTML and PHP Resources</title>
	<atom:link href="http://www.htmlandphp.com/feed" rel="self" type="application/rss+xml" />
	<link>http://www.htmlandphp.com</link>
	<description>Short easy to follow tutorials &#38; more...</description>
	<lastBuildDate>Thu, 16 May 2013 04:57:26 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>Getting Started With Heroku and PHP</title>
		<link>http://www.htmlandphp.com/heroku/getting-started-with-heroku-and-php.html</link>
		<comments>http://www.htmlandphp.com/heroku/getting-started-with-heroku-and-php.html#comments</comments>
		<pubDate>Thu, 16 May 2013 04:57:26 +0000</pubDate>
		<dc:creator>Bladymir</dc:creator>
				<category><![CDATA[Heroku]]></category>

		<guid isPermaLink="false">http://www.htmlandphp.com/?p=611</guid>
		<description><![CDATA[<p>What is Heroku Let&#8217;s start by taking a look at how Heroku describes themselves: Heroku (pronounced her-OH-koo) is a cloud application platform – a new way of building and deploying web apps. Our service lets app developers spend 100% of &#8230; <a href="http://www.htmlandphp.com/heroku/getting-started-with-heroku-and-php.html">Continue reading <span class="meta-nav">&#8594;</span></a></p><p><a href="http://www.htmlandphp.com" title="Simple easy to follow html and php video tutorials.">Visit www.HTMLandPHP.com for more information!</a></p>]]></description>
				<content:encoded><![CDATA[<h2>What is Heroku</h2>
<p>Let&#8217;s start by taking a look at how Heroku describes themselves:</p>
<blockquote><p>Heroku (pronounced her-OH-koo) is a cloud application platform – a new way of building and deploying web apps.</p>
<p>Our service lets app developers spend 100% of their time on their application code, not managing servers, deployment, ongoing operations, or scaling.</p></blockquote>
<p>Heroku is a cloud application platform. Alternatively, we can say Heroku provides Platform as a service (PAAS). Which means that their entire reason for being is to provide you a computing platform you need to run your application.</p>
<p>While browsing the Heroku webpage you will find that they support Ruby, Node.js, Clojure, Java, Python and Scala, and a well kept secret is that they support PHP applications as well, but you may have trouble finding any documentation for PHP in their Developer Center.</p>
<h2>How is Heroku Different From Standard Web Hosting?</h2>
<p>Heroku is different from regular web hosting in that they do not allocate a particular slice of space and cpu time on some machine in a data center.  Heroku provides a platform as a service that has the ability to scale with the requests that your web application receives.</p>
<p>Your application is deployed to Heroku, and then an instance is started up or assigned to an incoming request. What this means is that you have the ability to potentially serve more requests and scale your web application with greater ease.</p>
<p>Since Heroku does not allocate resources like a regular host, this also means that you do not have the type of file system access like ftp or ssh, as you may have had with a regular host.</p>
<p>Applications that are deployed to Heroku do need to be designed and thought out a bit different than those that are deployed to regular web-hosts due to the nature of the Heroku platform. These essential design choices however do lead to more scale-able application, which is what Heroku is all about.</p>
<h2>Workflow Of Heroku</h2>
<p>It should be noted that in order to work with Heroku, you need to have git and the the Heroku Tool-belt installed. Since Heroku leverages git to deploy applications it is an unavoidable fact that a reasonable amount of git experience should be had.</p>
<p>Deploying to Heroku is covered in more detail in later articles. A simple PHP application can still be created via typical methods using packages like XAMPP, WAMP, MAMP.</p>
<p>As mentioned earlier Heroku does not provide access to the file system, and the only method of deployment is through pushing your application via git to a remote Heroku server.</p>
<p>The process looks very roughly as follows:</p>
<ol>
<li><span style="line-height: 13px;">Create PHP Application or Pull an existing App from a Heroku remote url.</span></li>
<li>Keep version control via Git.</li>
<li>To deploy, push to a Heroku remote addresss.</li>
<li>Visit the Heroku addresss for your application.</li>
</ol>
<h2>Resources</h2>
<p><a title="Heroku Toolbelt" href="https://toolbelt.heroku.com/">Heroku Tool-Belt</a> &#8211; The heroku tool belt used for accessing your Heroku application<br />
<a title="Heoku Dev Center" href="https://devcenter.heroku.com/">Heroku Dev Center</a> &#8211; Heroku Documentatin.<br />
<a title="Git Download" href="http://git-scm.com/download">Git Version Control</a> &#8211; Git Version Control<br />
<a title="git tutorial" href="http://try.github.io/levels/1/challenges/1">Quick Git Tutorial</a> &#8211; GitHub Git Tutorial</p>
<p>Next:Get Started Using Heroku</p>
<p><a href="http://www.htmlandphp.com" title="Simple easy to follow html and php video tutorials.">Visit www.HTMLandPHP.com for more information!</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.htmlandphp.com/heroku/getting-started-with-heroku-and-php.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Time.ly WordPress Plugin &#8211; do_shortcode</title>
		<link>http://www.htmlandphp.com/scripts/time-ly-wordpress-plugin-do_shortcode.html</link>
		<comments>http://www.htmlandphp.com/scripts/time-ly-wordpress-plugin-do_shortcode.html#comments</comments>
		<pubDate>Mon, 27 Aug 2012 22:05:38 +0000</pubDate>
		<dc:creator>Bladymir</dc:creator>
				<category><![CDATA[Scripts]]></category>

		<guid isPermaLink="false">http://www.htmlandphp.com/?p=604</guid>
		<description><![CDATA[<p>The Time.ly plugin for wordpress handles the shortcodes differently than they are typically handled, which renders the do_shortcode() function in wordpress useless witht their shortcodes. To work around this you can do the following: function display_timely_calendar($attr = null, $content = &#8230; <a href="http://www.htmlandphp.com/scripts/time-ly-wordpress-plugin-do_shortcode.html">Continue reading <span class="meta-nav">&#8594;</span></a></p><p><a href="http://www.htmlandphp.com" title="Simple easy to follow html and php video tutorials.">Visit www.HTMLandPHP.com for more information!</a></p>]]></description>
				<content:encoded><![CDATA[<p>The Time.ly plugin for wordpress handles the shortcodes differently than they are typically handled, which renders the do_shortcode() function in wordpress useless witht their shortcodes.</p>
<p>To work around this you can do the following:</p>
<pre class="crayon-plain-tag"><code>function display_timely_calendar($attr = null, $content = null) {

    global $ai1ec_calendar_controller;

    echo '&lt;div id=&quot;ai1ec-container&quot; class=&quot;ai1ec-container thenly&quot;&gt;' ;
    $ai1ec_calendar_controller-&gt;view();
    echo '&lt;/div&gt;';
}</code></pre>
<p><a href="http://www.htmlandphp.com" title="Simple easy to follow html and php video tutorials.">Visit www.HTMLandPHP.com for more information!</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.htmlandphp.com/scripts/time-ly-wordpress-plugin-do_shortcode.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Working with Form Data in PHP</title>
		<link>http://www.htmlandphp.com/uncategorized/working-with-form-data-in-php.html</link>
		<comments>http://www.htmlandphp.com/uncategorized/working-with-form-data-in-php.html#comments</comments>
		<pubDate>Wed, 27 Jun 2012 21:10:24 +0000</pubDate>
		<dc:creator>Bladymir</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.htmlandphp.com/?p=595</guid>
		<description><![CDATA[<p>PHP is a language used for web development, and as such the way to gather use input is through web forms. That being said in this article I am going to discuss how to go about processing input — form &#8230; <a href="http://www.htmlandphp.com/uncategorized/working-with-form-data-in-php.html">Continue reading <span class="meta-nav">&#8594;</span></a></p><p><a href="http://www.htmlandphp.com" title="Simple easy to follow html and php video tutorials.">Visit www.HTMLandPHP.com for more information!</a></p>]]></description>
				<content:encoded><![CDATA[<p>PHP is a language used for web development, and as such the way to gather use input is through web forms. That being said in this article I am going to discuss how to go about processing input — form data — with PHP.</p>
<h2>Types of Input Data — GET &amp; POST</h2>
<p>Form data can be submitted to your PHP script either via GET or POST methods. Which method is used is dependent on which of the two is used in the <strong>method</strong> attribute of the <strong>form</strong> tag.</p>
<p>When the form data is submitted with a method of <strong>GET</strong> the data is encoded and appended onto the url of the <strong>action</strong> attribute of your from. So your form data can be read right from the url after it is submitted. Ultimately the get method is best used for form that have relatively trivial amounts of unimportant data. Keep in mind the data will be visible in the address bar of the browser.</p>
<p><strong>Post</strong> method differs in that the data is not transmitted in the URL after being submitted. The submitted data is transferred &#8220;behind the scenes&#8221; and is for the most part invisible to the user. Post also allows us to transfer more data.</p>
<h2>Accessing GET &amp; POST in PHP</h2>
<p>Now we know that we have two methods for transferring input to PHP. We first choose which method you prefer to use or fits your situation best.</p>
<p>If your about to use GET, PHP has an easy way to access that data you just transmitted. PHP has a global array in a variable called <strong>$_GET</strong> that allows us to access data send via the <strong>GET</strong> method. To access particular pieces of data you use the <strong>name</strong> attribute of your input, select, or textarea inside your form.</p>
<p>For example accessing the data in from an input field with name of &#8220;email&#8221;, we would use the following syntax in PHP.</p>
<pre class="crayon-plain-tag"><code>echo $_GET['email'];</code></pre>
<p>Accessing data that was transmitted via the <strong>POST </strong>method we would use the <strong>$_POST</strong> variable in the same manner, and our example would become&#8230;</p>
<pre class="crayon-plain-tag"><code>echo $_POST['email'];</code></pre>
<p>It really is that simple!</p>
<h2>Display All Keys and Values</h2>
<p>If you wanted to display all the data that was transmitted, you could use the print_r() or var_dump() functions to display a readable output of your array.</p>
<pre class="crayon-plain-tag"><code>print_r($_GET);

/* OR */

var_dump($_POST);</code></pre><p><p>
<p>Keep in mind that these varibales are just PHP arrays that are generated by the PHP interpreter when POST or GET data is present.</p>
<p>You can use array functions to check whether a given field was submitted, or a form field hold a particular value. For example&#8230;</p>
<pre class="crayon-plain-tag"><code>if($_POST['email'] == 'admin@admin.com')
    echo 'Welcome Admin!';</code></pre>
<h2>Word of Caution</h2>
<p>Security of scripts on the web is a huge concern for server security and security of data.  Using the value submitted via <strong>GET</strong> and <strong>POST</strong> without sanitizing or escaping potentially problematic code can cause a huge headache.</p>
<p>Make sure you escape your posted data using functions such as mysql_escpae_string(), trim(), strip_tags(), htmlentities() and possibly str_replace() and other similar functions to prevent &#8220;bad&#8221; data from being processed by your script and placing your website or server at risk of being victim to injection attacks and other unpleasant experiences.</p>
<p>&nbsp;</p>
<p><a href="http://www.htmlandphp.com" title="Simple easy to follow html and php video tutorials.">Visit www.HTMLandPHP.com for more information!</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.htmlandphp.com/uncategorized/working-with-form-data-in-php.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP Notices, Warnings, and Fatal Errors</title>
		<link>http://www.htmlandphp.com/beginner-php/php-notices-warnings-and-fatal-errors.html</link>
		<comments>http://www.htmlandphp.com/beginner-php/php-notices-warnings-and-fatal-errors.html#comments</comments>
		<pubDate>Thu, 14 Jun 2012 03:01:18 +0000</pubDate>
		<dc:creator>Bladymir</dc:creator>
				<category><![CDATA[Beginner PHP]]></category>
		<category><![CDATA[Introduction]]></category>

		<guid isPermaLink="false">http://www.htmlandphp.com/?p=584</guid>
		<description><![CDATA[<p>Just like any other programming language PHP comes with varying levels of error reporting.  For those of you familiar with compiled programming languages(eg: Java, C, C++, etc&#8230;) PHP&#8217;s error reporting is different than that found in compiled languages.  All the &#8230; <a href="http://www.htmlandphp.com/beginner-php/php-notices-warnings-and-fatal-errors.html">Continue reading <span class="meta-nav">&#8594;</span></a></p><p><a href="http://www.htmlandphp.com" title="Simple easy to follow html and php video tutorials.">Visit www.HTMLandPHP.com for more information!</a></p>]]></description>
				<content:encoded><![CDATA[<p>Just like any other programming language PHP comes with varying levels of error reporting.  For those of you familiar with compiled programming languages(eg: Java, C, C++, etc&#8230;) PHP&#8217;s error reporting is different than that found in compiled languages.  All the errors you receiver will present themselves at different points when running the PHP script.</p>
<h2>PHP Notices &amp; Warnings</h2>
<p>Notices and warnings in PHP do not stop execution of the script.  Notices are just that, notices from the interpreter about a particular line of code that did not hold an expected value. This often happens when we try to use variables which have not been declared or array indices which have not been defined.</p>
<p>For example: We might be declaring a variable or array index ONLY when a particular condition is true — inside and if-else statement — and then trying to use the variable.</p>
<p>In both of these cases, we would be trying to access the value of an undefined item.</p>
<p>To fix notices, we would simply make sure that the expected variable was declared, by making sure the logic of the script was sound — correct and valid.</p>
<p>It is entirely possible to turn off notices from appearing when the script executes. Although I would strongly suggest that scripts should be written in a way that ensures that they are free of errors. In the section below I will cover how error reporting can be adjusted.</p>
<h2>PHP Fatal Errors</h2>
<p>In the simplest terms Fatal Errors are errors that the PHP interpreter can simply not recover from.  These type of errors will stop the script from continuing, meaning after these errors are encountered.  The interpreter stops everything and displays the error.</p>
<p>The most common source of fatal errors is calling <em><strong>undeclared</strong></em> functions, or methods of objects, or classes (if using Object Oriented PHP), and mistakes in syntax.</p>
<p>Mistakes in syntax are typically followed by a message described as &#8220;Paser Error:&#8230;.&#8221; with the approximate line number of the mistake. These errors are mostly always easy to find, and typically translate to missing semi-colon, extra/missing parenthesis or quote to name a few of the things.</p>
<p>Calling undeclared functions or classes means that the functions has not been declared yet, or that you possibly have a typo in the name of the function you are calling.</p>
<p>Correcting the typo — if applicable — will fix the issue.</p>
<p>If its a custom declared function or class, you must make sure that the file where the function is declared is being included. In this case, ensure that your include path is correct, and that the expected functions or class declarations are in the file.</p>
<p>Lastly fatal errors may also be related to a script taking too long to execute or using too much memory to execute — beyond the time or space allowed in php.ini. To fix this you would increase the time or space allotted or adjust the script to reduce the time or amount of memory the script takes to execute.</p>
<h2>PHP Error Reporting</h2>
<p>Error reporting setting can be adjusted in php.ini settings file that configures your php installation. Alternately PHP error reporting can be adjusted via the <em><strong>error_reporting()</strong></em> function.</p>
<p>It should be noted that disabling error reporting means that warnings, notices, and fatal errors may be muted when they occur, which may make debugging very difficult.</p>
<p>Below is a snippet of code from php.net that uses global constants to specify which types of errors should be displayed. Note that the constants are integer values.</p>
<pre class="crayon-plain-tag"><code>//&nbsp;Turn&nbsp;off&nbsp;all&nbsp;error&nbsp;reporting
error_reporting(0);

//&nbsp;Report&nbsp;simple&nbsp;running&nbsp;errors
error_reporting(E_ERROR&nbsp;|&nbsp;E_WARNING&nbsp;|&nbsp;E_PARSE); //Bitwise OR

//&nbsp;Reporting&nbsp;E_NOTICE&nbsp;can&nbsp;be&nbsp;good&nbsp;too&nbsp;(to&nbsp;report&nbsp;uninitialized
//&nbsp;variables&nbsp;or&nbsp;catch&nbsp;variable&nbsp;name&nbsp;misspellings&nbsp;...)
error_reporting(E_ERROR&nbsp;|&nbsp;E_WARNING&nbsp;|&nbsp;E_PARSE&nbsp;|&nbsp;E_NOTICE); //Bitwise OR

//&nbsp;Report&nbsp;all&nbsp;errors&nbsp;except&nbsp;E_NOTICE
//&nbsp;This&nbsp;is&nbsp;the&nbsp;default&nbsp;value&nbsp;set&nbsp;in&nbsp;php.ini
error_reporting(E_ALL&nbsp;^&nbsp;E_NOTICE); //Bitwise xOR

//&nbsp;Report&nbsp;all&nbsp;PHP&nbsp;errors&nbsp;(as of 5.4.0)
error_reporting(E_ALL);

//&nbsp;Report&nbsp;all&nbsp;PHP&nbsp;errors
error_reporting(-1);

//&nbsp;Same&nbsp;as&nbsp;error_reporting(E_ALL);
ini_set('error_reporting',&nbsp;E_ALL);

/*Values
E_ERROR :&nbsp;1
E_WARNING: 2
E_PARSE: 4
E_NOTICE: 8
E_STRICT:&nbsp;2048
E_ALL:&nbsp;30719
*/</code></pre>
<h2>Conclusion</h2>
<p>Generally everyone should try to write sound code that is free of errors. Writing error free code will ensure that your scripts work consistently across various PHP configurations and ensure that everyone — including yourself — can read and follow your code after it was initially written.</p>
<p>Ensure error reporting is on when you are debugging and that you know what the various errors means and how you can go about correcting them.</p>
<p><a href="http://www.htmlandphp.com" title="Simple easy to follow html and php video tutorials.">Visit www.HTMLandPHP.com for more information!</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.htmlandphp.com/beginner-php/php-notices-warnings-and-fatal-errors.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Introduction to custom functions in PHP</title>
		<link>http://www.htmlandphp.com/beginner-php/introduction-to-custom-functions-in-php.html</link>
		<comments>http://www.htmlandphp.com/beginner-php/introduction-to-custom-functions-in-php.html#comments</comments>
		<pubDate>Thu, 01 Mar 2012 14:55:31 +0000</pubDate>
		<dc:creator>Bladymir</dc:creator>
				<category><![CDATA[Beginner PHP]]></category>
		<category><![CDATA[Start Writing PHP]]></category>

		<guid isPermaLink="false">http://www.htmlandphp.com/?p=541</guid>
		<description><![CDATA[<p>Introduction The PHP language has a few thousand functions built in and ready to use. Although several thousand functions exist it is entirely possible that the a function to accomplish something you are looking for may be too general for your purposes &#8230; <a href="http://www.htmlandphp.com/beginner-php/introduction-to-custom-functions-in-php.html">Continue reading <span class="meta-nav">&#8594;</span></a></p><p><a href="http://www.htmlandphp.com" title="Simple easy to follow html and php video tutorials.">Visit www.HTMLandPHP.com for more information!</a></p>]]></description>
				<content:encoded><![CDATA[<h3>Introduction</h3>
<p>The PHP language has a few thousand functions built in and ready to use. Although several thousand functions exist it is entirely possible that the a function to accomplish something you are looking for may be too general for your purposes or not exist at all.</p>
<p>Although a large number of functions in PHP may take parameters and do operations on those parameters, functions are also a great way to group commonly used code in order to improve readability and maintainability of a program.</p>
<h3>Defining a Function</h3>
<p>To define a function we are required to use the keyword, <strong><em>function</em></strong> followed by the function&#8217;s name and parenthesis encasing any parameters separated by a comma and a block of code wrapped in curly brackets.</p>
<p>Function definition without parameters: </p><pre class="crayon-plain-tag"><code>function printHello(){ echo 'Hello!'; }</code></pre>
<p>Function definition with one parameter: </p><pre class="crayon-plain-tag"><code>function sayHello($name){ echo 'Hello ', $name, '!'; }</code></pre>
<h3>Function Names</h3>
<p>Functions can have just about any name as long as they begin with a letter or underscore, the first character can be followed by any letter/number/underscore combination.</p>
<p>Names that are PHP keywords or already existing functions should be avoided. Naming custom functions the same as existing functions will result in error and will keep your script from running.</p>
<p>PHP does not support function overloading or re declaring of functions. Be unique and descriptive when naming your functions.</p>
<p>(Function overloading is simply when you define multiple functions with the same name, differing only in the number of parameters. To set optional parameters in php, you can use default values when you declare your function (see next section.))</p>
<h3>Function Parameters</h3>
<p>When we declare our custom function we can define the number of parameters that our function can accept. The number of parameters can range from none to as many as you want, they only need to be separated by a comma.</p>
<pre class="crayon-plain-tag"><code>// No Parameters
function hello0(){ /*code*/ }
// One Parameter
function hello1($par1){ /*code*/ }
// Two Parameter
function hello2($par1, $par2){ /*code*/ }
// Three Parameter
function hello3($par1, $par2, $par3){ /*code*/ }</code></pre><p> The names that are given to our parameters will be the names we will use inside our function&#8217;s block of code. </p><pre class="crayon-plain-tag"><code>function showName($name) {
echo $name;
}</code></pre><p><p><p><p> In the example above, our only parameter was given the identifier of <em>$name</em> and that is what is used inside our function to use the passed parameters value.</p>
<p>It should be noted that is the parameter that was passes is changed inside the function, the original value will remain unchanged.</p>
<pre class="crayon-plain-tag"><code>function changeName($name){
$name = 'James';
}

$user = 'Joe';
changeName($user);
echo $user; // Joe - still</code></pre><p><p><p><p><p> It should be noted that php functions can have optional parameters (which addresses the issue of function overloading). We have the freedom of setting default values for our functions, these default values are used when no value is passed to our function. Consider the example below:</p>
<pre class="crayon-plain-tag"><code>function printName($name = &quot;No Name&quot;){
echo $name;
}

$user = 'Joe';
printName($user);//echo's Joe
printName(); // echo's No Name</code></pre><p><p><p><p><p><p> Note how the parameter has become optional, if we do not specify a parameter, then the default from our function declaration is used. One thing to keep in mind about optional parameters is that <strong>no required parameters must come after the optional parameters.</strong> That is, you have to make sure any optional parameters are specified after required parameters(parameters with no default specified).</p>
<h3>Passing By Reference</h3>
<p>In our previous example the value held by our $<em>user</em> variable remained unchanged, this is because the value of the parameter is copied when it is passed to a function. In order for our original variable to be accessible and changeable we need to pass it by reference. Passing by reference simply means that our identifier inside our function will refer to the exact location in memory for the value that is being passed, rather than create a copy of it to work with.</p>
<p>Since <em>$name</em> inside our function refers to the same exact place and value as $<em>user</em> any changes to <em>$name</em> will also apply to <em>$user.</em></p>
<p>To pass by reference, we simply add a ampersand(&amp;) symbol to our parameter when we declare our function.</p><pre class="crayon-plain-tag"><code>function changeName(&amp;amp;$name){
$name = 'James';
}

$user = 'Joe';
changeName($user);
echo $user; // James - name changed!</code></pre><p><p><p><p><p><p><p>
<h3>Return Values</h3>
<p>Lastly we arrive at return values. Return values are data that a function send back when it finished running, the functions we have created so far do not return data after execution. To return data we must use the <strong>return</strong> keyword, followed by the variable name or data we are trying to return. It should be noted that the <strong>return</strong> keyword marks the end of the function, no code after the <strong>return</strong> is executed (unless you wrap your return in conditionals.) Consider the example below:</p><pre class="crayon-plain-tag"><code>function getName(){
$name = 'James';
return $name;
}

$user = getName();
echo $user; // James</code></pre><p><p><p><p><p><p><p><p>
We defined a function <em>getName()</em> which returns the value <em>James. </em>When we call the function the value is returned and we store the result in the variable <em>$user,</em> just as if it had been a string. Had we not returned the value from inside the function, the data would have ceased to exist after the function reached its end. We would not have had a value for our $<em>user</em> variable.</p>
<p>Note that you can return any type of data from a function, strings, integers, arrays, ect.</p>
<h3>Summary</h3>
<p>You should not be able to define your own custom functions, here we covered mostly the syntax and topics surrounding function, but when combined with your knowledge of other html topics it is a very powerful tool. Inside your functions body, you can do anything you can outside of a function and when it comes to reusing that particular block of code inside your function all you have to do is call your function!</p>
<p>If you have any questions, comments or suggestion feel free to leave a comment or contact me at php@htmlandphp.com.</p>
<p><a href="http://www.htmlandphp.com" title="Simple easy to follow html and php video tutorials.">Visit www.HTMLandPHP.com for more information!</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.htmlandphp.com/beginner-php/introduction-to-custom-functions-in-php.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Introduction to PHP Includes</title>
		<link>http://www.htmlandphp.com/beginner-php/introduction-to-php-includes.html</link>
		<comments>http://www.htmlandphp.com/beginner-php/introduction-to-php-includes.html#comments</comments>
		<pubDate>Sat, 31 Dec 2011 14:54:33 +0000</pubDate>
		<dc:creator>Bladymir</dc:creator>
				<category><![CDATA[Beginner PHP]]></category>
		<category><![CDATA[Start Writing PHP]]></category>

		<guid isPermaLink="false">http://www.htmlandphp.com/?p=521</guid>
		<description><![CDATA[<p>Introduction PHP includes refers to the four statements include, include_once, require, and require_once. These statements allow us to include PHP code written in other files in our current file and execute it as if it was part of our current one. Example Lets take &#8230; <a href="http://www.htmlandphp.com/beginner-php/introduction-to-php-includes.html">Continue reading <span class="meta-nav">&#8594;</span></a></p><p><a href="http://www.htmlandphp.com" title="Simple easy to follow html and php video tutorials.">Visit www.HTMLandPHP.com for more information!</a></p>]]></description>
				<content:encoded><![CDATA[<h3>Introduction</h3>
<p>PHP includes refers to the four statements <strong><em>include, include_once, require, </em></strong>and <strong><em>require_once.</em></strong> These statements allow us to include PHP code written in other files in our current file and execute it as if it was part of our current one.</p>
<h3>Example</h3>
<p>Lets take a simple HTML page and make it more dynamic with PHP.</p>
<p><a title="Sample HTML page" href="http://www.htmlandphp.com/examples/php/beginner/example_page.php">example_page.php</a></p><pre class="crayon-plain-tag"><code>&lt;?php
$title = &quot;Greatest Page!&quot;;
?&gt;
&lt;html&gt;
    &lt;head&gt;
        &lt;title&gt;
            &lt;?php echo $title; ?&gt; 
        &lt;/title&gt;
        &lt;style&gt;
            header {border-bottom:dotted 1px #AAA;}
            footer {border-top:dotted 1px #AAA;}
        &lt;/style&gt;
    &lt;/head&gt;
    &lt;body&gt;
        &lt;header&gt;
            &lt;h1&gt;
                &lt;?php echo $title; ?&gt;
            &lt;/h1&gt;
            &lt;p&gt;
                &lt;a href=&quot;#&quot;&gt;Home&lt;/a&gt; |
                &lt;a href=&quot;#&quot;&gt;About Us&lt;/a&gt; |
                &lt;a href=&quot;#&quot;&gt;Contact Us&lt;/a&gt;
            &lt;/p&gt;
        &lt;/header&gt;
        &lt;section&gt;
            &lt;h1&gt;Page1&lt;/h1&gt;
            &lt;p&gt;Hello World!&lt;/p&gt;
        &lt;/section&gt;
        &lt;footer&gt;
            &lt;p&gt;
                &lt;a href=&quot;#&quot;&gt;Home&lt;/a&gt; |
                &lt;a href=&quot;#&quot;&gt;About Us&lt;/a&gt; |
                &lt;a href=&quot;#&quot;&gt;Contact Us&lt;/a&gt;
            &lt;/p&gt;
        &lt;/footer&gt;
    &lt;/body&gt;
&lt;/html&gt;</code></pre></p>
<p>We can see that this page contains some reoccurring elements. We can take these reoccurring elements and put them in their own files and make it easier to reuse and maintain. For example if in the future you need to add a link to your pages you can edit a single file and the change will be reflected in all your pages, since they will all be pulling the same code from the same file.</p>
<p>Lets go ahead and split the code up into three files.</p>
<p>header.php </p><pre class="crayon-plain-tag"><code>&lt;html&gt;
    &lt;head&gt;
        &lt;title&gt;
            &lt;?php echo $title; ?&gt; 
        &lt;/title&gt;
        &lt;style&gt;
            header {border-bottom:dotted 1px #AAA;}
            footer {border-top:dotted 1px #AAA;}
        &lt;/style&gt;
    &lt;/head&gt;
    &lt;body&gt;
        &lt;header&gt;
            &lt;h1&gt;
                &lt;?php echo $title; ?&gt;
            &lt;/h1&gt;
            &lt;p&gt;
                &lt;a href=&quot;#&quot;&gt;Home&lt;/a&gt; |
                &lt;a href=&quot;#&quot;&gt;About Us&lt;/a&gt; |
                &lt;a href=&quot;#&quot;&gt;Contact Us&lt;/a&gt;
            &lt;/p&gt;
        &lt;/header&gt;</code></pre></p>
<p>home.php </p><pre class="crayon-plain-tag"><code>&lt;section&gt;
    &lt;h1&gt;Page1&lt;/h1&gt;
    &lt;p&gt;Hello World!&lt;/p&gt;
&lt;/section&gt;</code></pre></p>
<p>footer.php </p><pre class="crayon-plain-tag"><code>&lt;footer&gt;
            &lt;p&gt;
                &lt;a href=&quot;#&quot;&gt;Home&lt;/a&gt; |
                &lt;a href=&quot;#&quot;&gt;About Us&lt;/a&gt; |
                &lt;a href=&quot;#&quot;&gt;Contact Us&lt;/a&gt;
            &lt;/p&gt;
        &lt;/footer&gt;
    &lt;/body&gt;
&lt;/html&gt;</code></pre></p>
<p>Now that we have the code split up this way, we can reuse the code for our header and footer sections.</p>
<h3>Including the Content</h3>
<p>We have split the code up and now we are ready to use our methods, <strong>include, include_once, require</strong><em> and </em><strong>require_once</strong><em>. </em></p>
<p>These methods simply include the code of the specified location to our current file. for example, let create a new file, landing.php with the following code:</p>
<p><a title="Landing Example" href="http://www.htmlandphp.com/examples/php/beginner/landing.php">landing.php</a> </p><pre class="crayon-plain-tag"><code>&lt;?php
// Variable is used in our header
$title = &quot;Greatest Page!&quot;;
include 'header.php';
?&gt;

        &lt;section&gt;
            &lt;h1&gt;Welcome!&lt;/h1&gt;
            &lt;p&gt;Hola! Hello! Hallo! Salut!&lt;/p&gt;
        &lt;/section&gt;
&lt;?php
include 'footer.php';
?&gt;</code></pre></p>
<p>If you take a look at the final rendering of the page, you will notice it is the same as the original. These functions allow us to include code from other sources.</p>
<p>Its also important to note that variables can be used across included files, as long as it has been declared before the line it is used on. In our example we declared the variable $<em>title</em> and used it in our header file.</p>
<h3>Syntax</h3>
<p>These statements can be used with or with out parenthesis.</p>
<pre class="crayon-plain-tag"><code>include 'path/to/file.ext';

include('path/to/file.ext');</code></pre><p><p><p><p><p><p></p><pre class="crayon-plain-tag"><code>include_once 'path/to/file.ext';

include_once('path/to/file.ext');</code></pre><p><p><p><p><p><p><p></p><pre class="crayon-plain-tag"><code>require 'path/to/file.ext';

require('path/to/file.ext');</code></pre><p><p><p><p><p><p><p><p></p><pre class="crayon-plain-tag"><code>require_once 'path/to/file.ext'

require_once('path/to/file.ext');</code></pre><p><p><p><p><p><p><p><p>
<p>The path provided can be absolute or relative to the current directory or the include path specified in php.ini.</p>
<h3>Including vs Requiring</h3>
<p>These two constructs do the same thing and are interchangeable for the most part. The real difference is in the way that they handle errors.</p>
<p>Include issues a notice and execution of the script continues if the path of the specified file is not found.</p>
<p>Require issues an error and execution of the script stop at that point.</p>
<h3>Do it just once</h3>
<p>The two constructs <strong><em>require_once</em></strong> and <strong><em>include_once</em></strong> also do the same as <strong><em>require</em></strong> and <strong><em>include</em></strong> although as the name suggest they only do it once.What I mean by this is that if you had written two include statements in your script at different point for inclusion of the same file, the file would be included twice and the code in that file would be executed twice.</p>
<p>With the <strong><em>require_once</em></strong> and <strong><em>include_once</em></strong> constructs the PHP parser ignores any subsequent request for inclusion from <strong><em>require_once</em></strong> and <strong><em>include_once.</em></strong></p>
<p>It should be noted that any inclusion request using <strong><em>include </em></strong>and<strong> <em>require</em></strong> will be fulfilled normally. Use the constructs <strong><em>require_once</em></strong> and <em><strong>include_once</strong></em> to include any files that define functions, classes or other code that you do not want to be re-declared or executed a second time.</p>
<h3>Summary</h3>
<p>The constructs discussed here are simply a way to include contents of another file into the current one. The contents of the included files will be executed and displayed as if they had been written in the file that including it. Variables declared before the inclusion can be used in the included file, and variables, functions and classes declared inside the included file can be used in the file that including it.</p>
<p><a href="http://www.htmlandphp.com" title="Simple easy to follow html and php video tutorials.">Visit www.HTMLandPHP.com for more information!</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.htmlandphp.com/beginner-php/introduction-to-php-includes.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Introduction to Loops in PHP</title>
		<link>http://www.htmlandphp.com/beginner-php/introduction-to-loops-in-php.html</link>
		<comments>http://www.htmlandphp.com/beginner-php/introduction-to-loops-in-php.html#comments</comments>
		<pubDate>Sat, 31 Dec 2011 00:00:48 +0000</pubDate>
		<dc:creator>Bladymir</dc:creator>
				<category><![CDATA[Beginner PHP]]></category>
		<category><![CDATA[Start Writing PHP]]></category>

		<guid isPermaLink="false">http://www.htmlandphp.com/?p=494</guid>
		<description><![CDATA[<p>Introduction At the heard of the matter loops are a mechanism for executing instructions (code) multiple times. Loops give us the ability to automate certain tasks that can be done in a number or repeatable steps. Types of Loops In &#8230; <a href="http://www.htmlandphp.com/beginner-php/introduction-to-loops-in-php.html">Continue reading <span class="meta-nav">&#8594;</span></a></p><p><a href="http://www.htmlandphp.com" title="Simple easy to follow html and php video tutorials.">Visit www.HTMLandPHP.com for more information!</a></p>]]></description>
				<content:encoded><![CDATA[<h3>Introduction</h3>
<p>At the heard of the matter loops are a mechanism for executing instructions (code) multiple times.</p>
<p>Loops give us the ability to automate certain tasks that can be done in a number or repeatable steps.</p>
<h3>Types of Loops</h3>
<p>In PHP we have various types of loops and although at the core of it all they do the same thing, they go about doing it differently. Its important to note that certain things can be done with less effort in some loop structures while it may not be the case for other loop structures.</p>
<h3>Notes on Loop Syntax</h3>
<p>Loop syntax varies slightly for all loops, but the important thing to keep in mind is that the loops conduct a check before every iteration and expect a Boolean value during this check. This Boolean value tells the PHP interpreter whether it should continue to the rest of the code or continue executing the current block of code contained by the loop structure.</p>
<p>Loop structures have a block of code that is executed when the Boolean value is set to true. The block of code is defined between curly brackets ( { and } ), but if the curly brakets are omitted, then only the line following the loop declaration will be considered part of the loop&#8217;s block.</p>
<h4> &#8221;<em><strong>while</strong></em>&#8221; and &#8220;<em><strong>do</strong></em>&#8220;.. &#8220;<em><strong>while</strong></em>&#8221; Loops</h4>
<p>The <strong><em>while</em></strong> loop is the simplest in terms of syntax and has the widest range of uses. Declaring a while loop is as simple as using the keyword, <strong><em>while</em></strong>, followed by a boolean value or boolean expression wrapped in parenthesis followed by a block of code in curly brackets.</p>
<p><a title="While loop example" href="http://www.htmlandphp.com/examples/php/beginner/example_while.php" rel="nofollow" target="_blank">example_while.php</a>:</p><pre class="crayon-plain-tag"><code>&lt;?php
$x = 0;

while($x &lt; 10) {
    echo $x, &quot;&lt;br&gt;\n&quot;;
    $x++;
}</code></pre></p>
<p>Take note that the expression: $x &lt; 10 , is a evaluated to a true or false, and the code between the curly brackets is executed only when this expression is true. Be aware that we can substitute any boolean expression in this place.</p>
<p style="padding-left: 30px;"><em><strong>Warning</strong>: Setting forth an infinite(∞) loop is a possibility when the expression </em><strong>never</strong><em> evaluates to </em><strong>false</strong><em>, in which case the script would run the code in the loop until either the server kills the script or the server runs out of resources. This can be a problem in a shared hosting environment, where a web host may suspend your hosting for excessive use of resources. </em></p>
<p>The <strong><em>do&#8230;while</em></strong> loop is a variation of the <strong><em>while</em></strong> loop. The <strong><em>do&#8230;while</em></strong> loop guarantees that the block of code in the loop will be executed at least once. To use this type of loop, you use the keyword, <strong><em>do</em></strong>, followed by the block of code in curly brackets and the keyword <strong><em>while</em></strong> with a Boolean value or expression in parenthesis.</p>
<p><a title="Do While loop example" href="http://www.htmlandphp.com/examples/php/beginner/example_do_while.php" rel="nofollow" target="_blank">example_do_while.php</a>:</p><pre class="crayon-plain-tag"><code>&lt;?php

$x = 0;
do{
    echo $x;
    $x++;
} while ($x &lt; 0);</code></pre></p>
<p>Its important to note in this example the comparison is between a variable and a value of zero, the expression at the end will evaluate to false and the loop will stop there. However the code block was executed once because the comparison did not take place until after the block of code. This is a property unique to the <strong><em>do&#8230;while</em></strong> loop.</p>
<p>Note: The semi-colon after the <em>while(..)</em> is required, otherwise the code will yield errors.</p>
<h4>Parts of a &#8220;<em>for</em>&#8221; loop</h4>
<p>A <em><strong>for</strong></em> loop is a bit more complex than its while counter part, it contains a variable initialization, check condition, and a step.</p>
<p>This loop can be said to be a loop that keeps track of its own progress. A typical for loop is declared by using the keyword, <strong><em>for</em></strong>, followed by the three mentioned items wrapped in parenthesis and the block of code that will be executed.</p>
<p><a title="For Loop Example" href="http://www.htmlandphp.com/examples/php/beginner/example_for.php" rel="nofollow" target="_blank">example_for.php</a>:</p><pre class="crayon-plain-tag"><code>&lt;?php
$genres = array('Blues', 'Country', 'Rock', 'Rap');

/*
 * Start our index at 0
 * 
 * Execute the block as long as the number is
 * less than the number of items in the array
 * 
 * After executing the code, add one to the count (index).
 */
for($index = 0; $index &lt; count($genres); $index++) {
    // Access the n-th element of he $genres array. 
    // n-th refers to the number held by $index.
    echo 'Do you like ', $genres[$index] ,&quot; music?&lt;br&gt;\n&quot;;
}

/*
 * Simple example 2, counting from 1 to 10
 */
for($num = 1; $num &lt;= 10; $num++){
    echo $num, ',';
}</code></pre></p>
<p>As you can see from our example, the variable <em>$num</em> is declared and set to a value of one when we declare our <strong><em>for</em></strong> loop. The second part of the parameter listing is the boolean check that dictates the number of iterations our loop will go through. The last parameter is the step that our loop is to take after executing the block of code, in this case our step adds one to the value of <em>$num</em>.</p>
<p>It should also be noted that the variable <em>$num</em> will be available outside the block of the for loop, it&#8217;s continues to exist after the loop.</p>
<h3>The &#8220;<em>foreach</em>&#8220; loop</h3>
<p>The <strong><em>foreach</em></strong> loop is a special type of loop that is best used with iterateable items like arrays and objects. A foreach loop takes uses the keyword <strong><em>foreach</em></strong> and <strong><em> as</em></strong> in the following manner.</p>
<p><a title="Foreach Example" href="http://www.htmlandphp.com/examples/php/beginner/example_foreach.php" rel="nofollow" target="_blank">example_foreach.php</a>:</p><pre class="crayon-plain-tag"><code>&lt;?php
$colors = array('red', 'blue', 'green', 'magenta','cyan','yellow');

/*
 *  Each value fo the $colors array will be referred to as
 *  a $color (singular) inside the array.
 */

foreach($colors as $color){
    echo 'Do you like the color ', $color ,&quot;?&lt;br&gt;\n&quot;;
}</code></pre></p>
<p>Note that each of the items in our array (<em>$list</em>) was referred to as <em>$a_value</em> inside the block of code.</p>
<p>The number of time the loop would execute is dependent on how many items are in the provided parameter.</p>
<p>If you have an associative array (or an object) you can also use the following syntax to retrieve the name of the key (or property) and the value.</p>
<p><a title="Foreach Example" href="http://www.htmlandphp.com/examples/php/beginner/example_foreach_key_value.php" rel="nofollow" target="_blank">example_foreach_key_value.php</a>:</p><pre class="crayon-plain-tag"><code>&lt;?php

$alphabet = array(  'first'  =&gt; 'a',
                    'second' =&gt; 'b',
                    'third'  =&gt; 'c');

foreach($alphabet as $spot =&gt; $letter) {
    /* Each key and value combo will be referred to as 
     * $spot for the key name
     * $letter for the value of each key and value combination
     */
    echo 'The ', $spot ,' letter is ', $letter, &quot;.&lt;br&gt;\n&quot;;
}</code></pre></p>
<p>Take note how the =&gt; operator was used to indicate the name of the variable we used to reference the key and the name of the variable we used to reference the value of the current element.</p>
<p>The foreach loop is commonly used to deal with arrays when each value in the array needs to  be processed.</p>
<h3>Comparison</h3>
<p>Below we have an example of how the we can print the contents of an array to the screen using all the types of loops covered above.</p>
<p><a title="Comparison Example" href="http://www.htmlandphp.com/examples/php/beginner/example_loops_comparison.php" rel="nofollow" target="_blank">example_loops_comparison.php</a>:</p><pre class="crayon-plain-tag"><code>&lt;?php
echo '&lt;pre&gt;';
$br = &quot;\n&quot;;     // Line Break

$list = array(  'Monday',
                'Tuesday',
                'Wednesday',
                'Thursday',
                'Friday',
                'Saturday',
                'Sunday'    );

/*
 *  USING WHILE LOOP
 */
echo $br, &quot;+WHILE OUTPUT------------------------------+&quot;, $br;

$count = 0;     // Array index begins at 0
while ($count &lt; count($list)) {
    echo $list[$count] ,  $br;
    $count++;   // Move index to next one by adding 1
}

/*
 *  USING A DO WHILE LOOP
 */
echo $br, &quot;+DO...WHILE OUTPUT------------------------------+&quot;, $br;

$count = 0;   // Reset our count
do {
    echo $list[$count] ,  $br;
    $count++;   // Move index to next one by adding 1
} while ($count &lt; count($list));

/*
 *  USE A FOR LOOP
 */
echo $br, &quot;+FOR OUTPUT------------------------------+&quot;, $br;

for ($count = 0; $count &lt; count($list); $count++) {
    echo $list[$count] ,  $br;
}

/*
 *  USE A FOREACH LOOP
 */
echo $br, &quot;+FOREACH OUTPUT------------------------------+&quot;, $br;

foreach ($list as $day) {
    echo $day,  $br;
}


echo $br, &quot;print_r OUTPUT------------------------------+&quot;, $br;

print_r($list);
echo '&lt;/pre&gt;';</code></pre></p>
<h3>Breaking out</h3>
<p>Loops check whether a condition has changed after every iteration, sometimes its necessary to exit a loop when a condition outside this primary condition is reached. The <strong><em>break</em></strong> keyword is used inside a loop to indicate that the loop should be exited.</p>
<p><a title="Comparison Example" href="http://www.htmlandphp.com/examples/php/beginner/example_loops_break.php" rel="nofollow" target="_blank">example_loops_break.php</a>:</p><pre class="crayon-plain-tag"><code>&lt;?php
$br = &quot;&lt;br&gt;\n&quot;;
// Numbers from 0 to 4 displayed
$count = 0;     
while ($count &lt; 5) {
    echo $count, $br;
    $count++;   
}


// Numbers 0 displayed
$count = 0;
while ($count &lt; 5) {
    echo $count, $br;
    $count++;   

    // Exit our loop
    break;
}

// Numbers from 0 to 3
$count = 0;
while ($count &lt; 5) {
    echo $count, $br;
    $count++;   

    // Exit our loop when count reaches a value of 4
    if($count == 4)
        break;
}</code></pre></p>
<p>In the example above we have a break statement inside our while loop that simply exits the loop as soon as the PHP parser reaches the line. We also have the break after an if-condition that allows us to specify when we should exit the loop.</p>
<p>Using the break keyword is simple, and it is typically used to exit loops in special cases specified by you with series of conditionals inside the loop. The example demonstrated this ability with the while loop, but it works in the same manner with the other types of loops.</p>
<h3>Summary</h3>
<p>In summary the loop structures in PHP are, <strong><em>while, do&#8230;while, for, </em></strong>and <strong><em>foreach</em></strong>. These loops have varying syntax&#8217;s and required parameters. At the root they all execute a block of code a number of times dictated by a given condition.  Note that they can be used interchangeably for the most part, but certain tasks are made easier by some loop structures.</p>
<p><a href="http://www.htmlandphp.com" title="Simple easy to follow html and php video tutorials.">Visit www.HTMLandPHP.com for more information!</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.htmlandphp.com/beginner-php/introduction-to-loops-in-php.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP Functions that Help You Debug</title>
		<link>http://www.htmlandphp.com/beginner-php/php-functions-that-help-you-debug.html</link>
		<comments>http://www.htmlandphp.com/beginner-php/php-functions-that-help-you-debug.html#comments</comments>
		<pubDate>Sat, 24 Dec 2011 03:29:30 +0000</pubDate>
		<dc:creator>Bladymir</dc:creator>
				<category><![CDATA[Beginner PHP]]></category>
		<category><![CDATA[Other Beginner PHP]]></category>

		<guid isPermaLink="false">http://www.htmlandphp.com/?p=470</guid>
		<description><![CDATA[<p>Introduction Writing code can be a daunting task filled with unexpected twist and turns even when we feel that we have everything planned out. We will be covering some of the major functions in PHP that can be used for debugging our &#8230; <a href="http://www.htmlandphp.com/beginner-php/php-functions-that-help-you-debug.html">Continue reading <span class="meta-nav">&#8594;</span></a></p><p><a href="http://www.htmlandphp.com" title="Simple easy to follow html and php video tutorials.">Visit www.HTMLandPHP.com for more information!</a></p>]]></description>
				<content:encoded><![CDATA[<h3>Introduction</h3>
<p>Writing code can be a daunting task filled with unexpected twist and turns even when we feel that we have everything planned out.</p>
<p>We will be covering some of the major functions in PHP that can be used for debugging our code, to track down unexpected execution and unexpected errors.  The functions we will focus on are:</p>
<ul>
<li><em><strong>echo()</strong></em></li>
<li><em><strong>print_r()</strong></em></li>
<li><em><strong>var_dump()</strong></em></li>
<li><em><strong>isset() </strong></em></li>
<li><em><strong>empty()</strong></em></li>
<li><em><strong>exit()</strong></em> and <em><strong>die()</strong></em></li>
</ul>
<h3>Printing Details to the Screen</h3>
<p>PHP programming at its root is writing a set of instructions that are going to be parsed and executed. Although we may think that we know what is going to happen, we get unexpected results at times. To track down whats going wrong and where its going wrong we need to print extra statements to the screen so we can confirm that what we expect is happening is in actuality taking place.</p>
<h3>Our old friend <em>echo()</em></h3>
<p>In a script that is giving us unexpected output, it is crucial that we trace our way through the script or through what we believe to be culprit, echo provides a basic means of doing so.</p>
<p>Using extra echoes into our scripts can help us confirm the existence of a variable and the value it holds.</p>
<p>For example, below we have taken a snippet of code and we have added echo statements at different points along the script with additional information for us comments. This helps us follow the logic of the script and the value of our selected variable at different points in the execution.</p>
<p><a title="PHP Echo Dubugging Example" href="http://www.htmlandphp.com/examples/php/beginner/example_debug_echo.php" rel="nofollow" target="_blank">example_debug_echo.php</a> :</p><pre class="crayon-plain-tag"><code>&lt;?php
$number = 1;

echo '&lt;b&gt;Starting:&lt;/b&gt; '. $number .'&lt;br&gt;';  // Display our starting number
for($count = 2; $count &lt;= 10; $count += 2)
{
    echo 'Before:'. $number . '&lt;br&gt;';       // Display number before operation
    $number *= $count;
    echo 'After:'. $number . '&lt;br&gt;&lt;br&gt;';    // Display number after operation
}
echo '&lt;b&gt;Ending:&lt;/b&gt; '. $number;            // Display our final number</code></pre></p>
<p>This is an exaggerated example, but in reality we may have to do something like this in our scripts in order to track down where an error has occurred. Although this is a basic approach to debugging it can be an effective one.</p>
<h3>Printing Arrays, Object and Additional Information Printing</h3>
<p>The functions <em><strong>var_dump()</strong></em> and <em><strong>print_r()</strong></em> are used exclusively for debugging purposes. These two functions are identical in function but differ in the output that they display.</p>
<p>The <strong><em>print_r()</em></strong> function displays a variables contents in a readable format. This does not mean much for variables holding primitive data type like strings, integers and floating points, as they are simply printed to the screen, but arrays and objects get formatted into a string representation before they are printed to the screen.</p>
<p>The function <em><strong>var_dump()</strong></em> formats the value of its parameters into a readable form and displays information about the variables data type in addition to its value.</p>
<p>Here&#8217;s and example to show how both functions display the variables information in a more readable format in the case of strings and arrays.</p>
<p><a title="PHP Print_r Var_dump Dubugging Example" href="http://www.htmlandphp.com/examples/php/beginner/example_print_r_var_dump.php" rel="nofollow" target="_blank">example_print_r_var_dump.php</a> :</p><pre class="crayon-plain-tag"><code>&lt;pre&gt;
&lt;?php
$aString = &quot;Hello Dolly&quot;;
$anArray = array('name' =&gt; 'Joel', 'age' =&gt; '20');

// A String
echo &quot;A string and print_r():\n&quot;;
print_r($aString);

echo &quot;\n\nA string and var_dump():\n&quot;;
var_dump($aString);

// An Array
echo &quot;\n\nAn array and print_r():\n&quot;;
print_r($anArray);

echo &quot;\n\nAn array and var_dump():\n&quot;;
var_dump($anArray);

?&gt;
&lt;/pre&gt;</code></pre></p>
<p>Note that these functions are most useful when trying to debug arrays and objects. The visual structuring of the data makes it easier to read which arrays or properties are encased and by what names or keys they can be accessed. The <em><strong>var_dump()</strong></em> function is useful when confirming the type of data a variable holds, note in the example above, the &#8216;<em>age</em>&#8216; key of the &#8216;<em>anArray&#8217;</em> variable holds a <strong>string</strong> of value 20, rather than an <strong>integer</strong> of value 20.</p>
<h3>Is the Variable Ready</h3>
<p>Next we have the functions <strong><em>isset()</em></strong> and <strong><em>empty()</em></strong>. These function simply establish whether a variable has been set or contains a value.</p>
<p>If you recall PHP is a loosely typed language and variables are allowed to contain any type of data. Variables do not need to be declared or instantiated before they are used, but in certain cases it is useful to know if a variable has been set or if it contains any value at all.</p>
<p>The <strong>isset()</strong> function tells us if a variable has been set by returning a <strong>boolean</strong> value of <strong>true</strong> or <strong>false</strong>.</p>
<p>In the following example we can see how we can check a variable to for whether or not it has been set.</p>
<p><a title="PHP isset example" href="http://www.htmlandphp.com/examples/php/beginner/example_isset.php" target="_blank">example_isset.php</a> :</p><pre class="crayon-plain-tag"><code>&lt;?php

/*
 * Set the variable
 * Then use isset to see if we have declared it
 */
$var1 = 'Some Value';

if(isset($var1))
    echo 'Variable 1 is set! &lt;br&gt;';
else
    echo 'Variable 1 is not set!&lt;br&gt;';

/* 
 * We have not declared $var2 anywhere
 * Can you guess what the output will be?
 */
if(isset($var2))
    echo 'Variable 2 is set! &lt;br&gt;';
else
    echo 'Variable 2 is &lt;b&gt;not&lt;/b&gt; set!&lt;br&gt;';</code></pre></p>
<p>The <strong>empty()</strong> function tells us if a variable is empty,</p>
<p>In this modified example we can see that a set variables is considered empty if it contains the boolean equivalent of false or if the variable has not been set.</p>
<p><a title="Empty PHP Example" href="http://www.htmlandphp.com/examples/php/beginner/example_empty.php" target="_blank">example_empty.php</a> :</p><pre class="crayon-plain-tag"><code>&lt;?php

/*
 * set the variable and a value
 * Then use empty to see if we have an empty value
 */
$var1 = 'Some Value';

if(empty($var1))
    echo 'Variable 1 is empty! &lt;br&gt;';
else
    echo 'Variable 1 is not empty!&lt;br&gt;';

// Change the value to an empty string
$var1 = '';
if(empty($var1))
    echo 'Variable 1 is empty!(Contains an empty string) &lt;br&gt;';
else
    echo 'Variable 1 is not empty!&lt;br&gt;';

/* 
 * We have not declared $var2 anywhere
 * Can you guess what the output will be?
 */
if(empty($var2))
    echo 'Variable 2 is empty! &lt;br&gt;';
else
    echo 'Variable 2 is &lt;b&gt;not&lt;/b&gt; empty!&lt;br&gt;';</code></pre></p>
<h3>Run it or Exit() or Die()</h3>
<p>Lastly we have the constructs <strong><em>exit()</em></strong> and <strong><em>die()</em></strong>. These constructs terminate the script at the point they are used.</p>
<p>When using these constructs we can pass a string parameter that will be printed when the script exits.</p>
<p><a title="Exit and Die Example PHP" href="http://www.htmlandphp.com/examples/php/beginner/example_exit_die.php" target="_blank">example_exit_die.php</a> :</p><pre class="crayon-plain-tag"><code>&lt;?php
$error = true;

if($error)
    exit('An Error Occured. Unable to continue.'); // die() is equivalent

echo 'Welcome!';</code></pre></p>
<p>Note that the last echo was not executed since the exit command was executed.</p>
<p>We can also use the <em><strong>or</strong></em> keyword as part of a statement with exit() and die() to determine if the script should continue. The left hand side of the <strong><em>or</em></strong> is interpreted as a boolean value, when the left hand side of the expression is false the right hand side gets executed.</p>
<p><a title="OR Exit and Die Example PHP" href="http://www.htmlandphp.com/examples/php/beginner/example_or_exit_die.php" target="_blank">example_or_exit_die.php</a> :</p><pre class="crayon-plain-tag"><code>&lt;?php
$bar = &quot;Hello&quot;;
$foo = isset($bar) or die('An Error Occured. $bar was not set.');
echo 'Welcome! $bar was set.';

/* Note we have not declared $tag*/
$fee = isset($tag) or die('An Error Occured. $tag was not set.');
echo 'Welcome! $tag was set.';</code></pre></p>
<p>The example above checks whether a variable is set and the proceeds or exits the script. It is a short hand version of the if statement in the previous example.</p>
<p>The exit and die statements can be used when debugging a script and we want to stop execution at a certain point. Note that they are interchangeable.</p>
<h3>Summary</h3>
<p>Tracking down unexpected outcomes in our scripts simplifies to finding where were we have defined incorrect logic or an incorrect order of steps. Printing the type and value of variables is helpful in order to correct any errors in our script.</p>
<ul>
<li>Printing useful information at different steps in your script with <strong><em>echo.</em></strong></li>
<li>Confirm the key and value pairs in arrays and properties of object by using the <em><strong>print_r</strong></em> and <em><strong>var_dump</strong></em> functions.</li>
<li>Check whether a variable has been instantiated by using <em><strong>isset</strong></em>.</li>
<li>See if a variable contains an empty value or has not been set by using <em><strong>empty</strong></em>.</li>
<li>Its important to note that <em><strong>isset</strong></em> is not the same as <em><strong>empty</strong></em></li>
<li>Stop execution of a script when arriving at a certain condition by using <em><strong>exit</strong></em> and <em><strong>die</strong></em>.</li>
</ul>
<p>These functions are key to debugging or narrowing down problems in PHP scripts, although they can also become part of your script in order to handle errors appropriately.</p>
<h3>Comments, Questions or Concerns</h3>
<p>If you have any comments, questions or concerns feel free to voice them on this site or contact us directly at <strong>php@htmlandphp.com</strong></p>
<p><a href="http://www.htmlandphp.com" title="Simple easy to follow html and php video tutorials.">Visit www.HTMLandPHP.com for more information!</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.htmlandphp.com/beginner-php/php-functions-that-help-you-debug.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>207: Introduction to arrays in PHP</title>
		<link>http://www.htmlandphp.com/beginner-php/207-introduction-to-arrays-in-php.html</link>
		<comments>http://www.htmlandphp.com/beginner-php/207-introduction-to-arrays-in-php.html#comments</comments>
		<pubDate>Wed, 21 Dec 2011 15:45:36 +0000</pubDate>
		<dc:creator>Bladymir</dc:creator>
				<category><![CDATA[Beginner PHP]]></category>
		<category><![CDATA[Start Writing PHP]]></category>

		<guid isPermaLink="false">http://www.htmlandphp.com/?p=440</guid>
		<description><![CDATA[<p>Introduction Arrays are a special data type in PHP that is used to hold a list of data. The ability to hold a list of data is valuable as it allows us to hold and pass sets of related data to &#8230; <a href="http://www.htmlandphp.com/beginner-php/207-introduction-to-arrays-in-php.html">Continue reading <span class="meta-nav">&#8594;</span></a></p><p><a href="http://www.htmlandphp.com" title="Simple easy to follow html and php video tutorials.">Visit www.HTMLandPHP.com for more information!</a></p>]]></description>
				<content:encoded><![CDATA[<h3>Introduction</h3>
<p>Arrays are a special data type in PHP that is used to hold a list of data. The ability to hold a list of data is valuable as it allows us to hold and pass sets of related data to different point in our application with ease.</p>
<h3>Array Syntax</h3>
<p>The simplest way to use arrays is it declare one using the <strong><em>array()</em></strong> function when declaring a variable.  There are a couple different ways to add data to an array, we can assign a value to the array with an empty index or by passing the values as parameters to the <strong><em>array()</em></strong> function.</p>
<p>When the <strong><em>array()</em></strong> function is used without any parameters an empty array is created.</p><pre class="crayon-plain-tag"><code>$ourList = array();</code></pre>
<p>Passing values as parameters creates a non empty array. Passing a value to the array with an empty index also pushes a value to the end of the array.</p>
<pre class="crayon-plain-tag"><code>&lt;?php
/* Fill an array by passing values as parameters */
$ourList = array('Hello', 'World'); // pass values as parameters

var_dump($ourList);     // Visual Representation of the array.


/* Filling an array by passing an empty index */
$ourList2 = array();         // empty array
$ourList2[] = 'Hello';       // pushes a value into the array
$ourList2[] = 'World';       // pushes a value into the array

var_dump($ourList2);     // Visual Representation of the array.</code></pre></p>
<p><em><strong>Note</strong></em>: In the case that the array has not been explicitly created, simply using array syntax and assigning it a value will create an array with the key(<em>if any</em>) and values provided.</p>
<h3>Array Indices</h3>
<p>Arrays hold data as list and  list held by the array needs to be access in order to be useful. If you use a function like <em><strong>var_dump()</strong></em> or <em><strong>print_r()</strong></em> you can see a visual representation of the array like below:</p>
<table>
<tbody>
<tr>
<td>array(2) {</td>
</tr>
<tr>
<td></td>
<td>[0]=&gt;</td>
</tr>
<tr>
<td></td>
<td>string(5) &#8220;Hello&#8221;</td>
</tr>
<tr>
<td></td>
<td>[1]=&gt;</td>
</tr>
<tr>
<td></td>
<td>string(5) &#8220;World&#8221;</td>
</tr>
<tr>
<td></td>
<td>}</td>
</tr>
</tbody>
</table>
<p>Our array consists of two string values with a length of five characters. The important thing to notice is the value in the square brackets, this is the <strong><em>index</em></strong> that is used to refer to that value.</p>
<p>To access a given item in an array we simply use the name of the variable that holds the array and then use the index of the item in square brackets.</p><pre class="crayon-plain-tag"><code>&lt;?php
# Fill an array by passing values as parameters 
$names = array('Leon', 'Ivan', 'John', 'Mohamed', 'Jose'); 

echo $names[0], &quot;&lt;br&gt;\n&quot;; // Displays: Leon
echo $names[1], &quot;&lt;br&gt;\n&quot;; // Displays: Ivan
echo $names[2], &quot;&lt;br&gt;\n&quot;; // Displays: John
echo $names[3], &quot;&lt;br&gt;\n&quot;; // Displays: Mohamed
echo $names[4], &quot;&lt;br&gt;\n&quot;; // Displays: Jose

# Visual representation of array.
var_dump($names);</code></pre></p>
<p>By default array indices begin at zero and count to one minus the number of elements. So the array above has five elements and the indices range from zero to four.</p>
<p><em><strong>Note</strong></em>: Indices can also be referred to as <em><strong>key</strong></em>s.</p>
<h3>Specifying Indices(keys)</h3>
<p>PHP automatically specifies the indices for arrays when none is specified. We can specify a different key starting point or do away with numerical numbering and use a string key names for our arrays indices.</p>
<p>To start numbering at a different value, we simply use the  <em><strong>&#8220;=&gt;&#8221;</strong></em> operator when we specify our values. It should be noted that the parser will number any indices after that point in sequential order until a different index value is specified.</p><pre class="crayon-plain-tag"><code>&lt;?php
$br = &quot;&lt;br&gt;\n&quot;; // Used for formatting

/**************************  EXAMPLE 1 ************************************/
// Specify the count to start at 1 rather than 0
$ourList = array(1 =&gt; 'Mercury', 'Venus');
echo $ourList[1], $br;     // Displays: Mercury
echo $ourList[2], $br;     // Displays: Venus


/**************************  EXAMPLE 2 ************************************/
// Specify the a different index for certain values
$ourList2 = array(1 =&gt; 'Mercury', 'Venus', 4 =&gt; 'Mars');    // 3 not defined!
echo $ourList2[1], $br;     // Displays: Mercury
echo $ourList2[2], $br;     // Displays: Venus
echo $ourList2[4], $br;     // Displays: Mars


/**************************  EXAMPLE 3 ************************************/
// Specify a string key
$ourList3 = array('home' =&gt; 'Earth',        // key: home     value: Earth
                  'largest' =&gt; 'Jupiter',   // key: largest  value: Jupiter
                  'center' =&gt; 'Sun',        // key: center   value: Sun
                  'Astroid Belt');          // key: 0        value: Astroid Belt

echo $ourList3['home'], $br;        // Displays: Earth
echo $ourList3['largest'], $br;     // Displays: Jupiter
echo $ourList3['center'], $br;      // Displays: Sun
echo $ourList3[0], $br;             // Displays: Astroid Belt</code></pre></p>
<p><em><strong>Note</strong></em>: PHP does not take white space into account when parsing code, for readability the example shows how we can set different keys and values on their own line. Arrays that contains string key names are refereed to as <em><strong>associative arrays</strong></em></p>
<h3>Arrays Inside Arrays</h3>
<p>Arrays are nothing more than a list that holds other data types. Arrays can also be multi-dimensional, meaning that they can hold other arrays and those arrays can hold other arrays so on so forth. We can define arrays like the example below, or you can nest <em><strong>array()</strong></em> functions in one another.</p>
<pre class="crayon-plain-tag"><code>&lt;?php
$family = array();

// key 'adults' contains an array with keys and values
$family['adults'] = array(
                        'mother' =&gt; 'Lea', 
                        'father' =&gt; 'Lucas'
                    );

$family['children'] = array(
                        'son' =&gt; 'Leo',
                        'daughter' =&gt; 'Lisa'
                    );

echo $family['adults']['father'], &quot;&lt;br&gt;\n&quot;;      // Displays: Lea
echo $family['adults']['mother'], &quot;&lt;br&gt;\n&quot;;      // Displays: Lucas
echo $family['children']['son'], &quot;&lt;br&gt;\n&quot;;       // Displays: Leo
echo $family['children']['daughter'], &quot;&lt;br&gt;\n&quot;;  // Displays: Lisa

print_r($family);   // Visual Representation of the array</code></pre></p>
<p><em><strong>Note:</strong></em> To access the data inside the inner array you specify a key of the array holding the inner array, then the key of the enclosed array.</p>
<pre class="crayon-plain-tag"><code>$variableName['outer array key']['inner array key'];</code></pre><p><em><strong>Note:</strong></em> This pattern continues if more arrays are enclosed.</p>
<h3>Array Related Error</h3>
<p>While using arrays we may occasionally come across the following error.</p>
<pre class="crayon-plain-tag"><code>Notice: Undefined offset: key in file.php on line 20</code></pre>
<p>Depending on the PHP setting on the server, this may or may not display. In this example this is a PHP notice, which means the rest of our script will finish parsing and continue to be executed, in contrast if this was a fatal error our PHP script would stop executing all together.</p>
<p>All this notice means is we have not defined this particular key for our array. To fix this we need to specify the key the parser is trying to find at(<em>or around</em>) the line it specifies or remove this reference all together, depending on what our script is supposed to be doing.</p>
<h3>Summary</h3>
<p>Arrays are a special data type in PHP that can hold a list of data including other arrays.  Arrays have sequential numerical keys (indices), but you have the ability to specify string key names or an alternate starting number. Arrays are commonly used to group related data in order to make it simple to pass the data to different parts of an application.</p>
<h3>Comments, Questions or Concerns</h3>
<p>If you have any comments, questions or concerns feel free to voice them on this site or contact us directly at <strong>php@htmlandphp.com</strong></p>
<p><a href="http://www.htmlandphp.com" title="Simple easy to follow html and php video tutorials.">Visit www.HTMLandPHP.com for more information!</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.htmlandphp.com/beginner-php/207-introduction-to-arrays-in-php.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>206: Introduction to Switch Conditionals in PHP</title>
		<link>http://www.htmlandphp.com/beginner-php/introduction-to-switch-conditionals-in-php.html</link>
		<comments>http://www.htmlandphp.com/beginner-php/introduction-to-switch-conditionals-in-php.html#comments</comments>
		<pubDate>Tue, 20 Dec 2011 06:24:43 +0000</pubDate>
		<dc:creator>Bladymir</dc:creator>
				<category><![CDATA[Beginner PHP]]></category>
		<category><![CDATA[Start Writing PHP]]></category>

		<guid isPermaLink="false">http://www.htmlandphp.com/?p=356</guid>
		<description><![CDATA[<p>Introduction Switch is another language construct that is used to control program flow. The switch construct takes a single parameter and compares it for equality to a set of cases that have been specified. Example Scenerio Let&#8217;s take an take the classic &#8230; <a href="http://www.htmlandphp.com/beginner-php/introduction-to-switch-conditionals-in-php.html">Continue reading <span class="meta-nav">&#8594;</span></a></p><p><a href="http://www.htmlandphp.com" title="Simple easy to follow html and php video tutorials.">Visit www.HTMLandPHP.com for more information!</a></p>]]></description>
				<content:encoded><![CDATA[<h3>Introduction</h3>
<p><strong><em>Switch</em></strong> is another language construct that is used to control program flow. The <strong><em>switch</em></strong> construct takes a single parameter and compares it for equality to a set of <em>cases</em> that have been specified.</p>
<h3>Example Scenerio</h3>
<p>Let&#8217;s take an take the classic case where we have seven days, represented by the numbers from zero to six.</p>
<p>We are going to pass a variable holding a number to our switch, the switch then looks for the case where the parameter it is passed is equal to a case. The parser then executes the code after the matching case. The parser continues to execute code until the end of the switch or a break statement is reached.</p>
<h3>What is a &#8220;break&#8221;?</h3>
<p>The<strong></strong><em><strong> break</strong></em> is used to tell the parser to break or stop executing the current block of code. A break statement is required to indicate the end of a block inside a switch, much like the curly brackets are used to indicate the start and end of a block after an if statement.</p>
<h3>Implementing a Switch</h3>
<h4>One Input to One Block</h4>
<p>The script below echoes the name of a day depending on the value of our variable <strong>$day.</strong> In this scenario, there is one output for a single input. </p><pre class="crayon-plain-tag"><code>&lt;?php
$day = 4;

switch ($day){
    case 0 : 
        echo 'Sunday';
        break;
    case 1 : 
        echo 'Monday';
        break;
    case 2 : 
        echo 'Tuesday';
        break;
    case 3 : 
        echo 'Wednesday';
        break;
    case 4 : 
        echo 'Thursday';
        break;
    case 5 : 
        echo 'Friday';
        break;
    case 6 : 
        echo 'Saturday';
        break;
}
?&gt;</code></pre></p>
<h4>Multiple Input to a Single Block</h4>
<p>Inside a switch we are also able to have multiple possible input values with a single output. To do this you simply group a number of cases one after another and follow with an appropriate block of code. For example the script below tells you if the number is even or odd. </p><pre class="crayon-plain-tag"><code>&lt;?php
$day = 4;

switch ($day){
    case 0 :
    case 2 :
    case 4 :
    case 6 :
    case 8 :
    case 10 :
        echo 'Even!';
        break;
    case 1 :
    case 3 :
    case 5 :
    case 6 :
    case 7 :
    case 11 :
        echo 'Odd!';
        break;
}
?&gt;</code></pre></p>
<h4>The Undefined Case</h4>
<p>If for any reason the value of the variable being compared did not have a case defined, no code inside the switch would execute since a case for that particular value is not defined. We have the option to define a default case that will be executed if the value of parameter being compared is not found. We define the default case with the <strong><em>default</em></strong> keyword in place of the case and the value.</p>
<p>In the example below we have grouped the values from zero to six so that they execute the code echoing, &#8220;Its a valid day from 0 to 6!&#8221;. If the parameter passed to the switch has any other value it will display the code defined after the default case.</p><pre class="crayon-plain-tag"><code>&lt;?php
$day = 10;

switch ($day) {
    case 0 :
    case 1 :
    case 2 :
    case 3 :
    case 4 :
    case 5 :
    case 6 :
        echo 'Its a valid day from 0 to 6!';
        break;
    default :
        echo 'Not a valid number for a day!';
        break;
}
?&gt;</code></pre></p>
<h3>Note about the &#8220;break&#8221;</h3>
<p>The break tells the parser to stop executing the current block of code. If you happen to omit the break from your cases inside the switch, the parser will execute all of the code starting at the matching case. Leaving the break out can result in unexpected output, remember to use the break to indicate the end of a cases&#8217; block of code.</p>
<h3> Switch vs If-Else</h3>
<p>You may have noticed some similarities between the switch and if-else blocks. Both of these constructs act in a similar manner and they can both <em>almost</em> be used interchangeably. The decision on which to use is yours.</p>
<h3>Comments, Questions or Concerns</h3>
<p>If you have any comments, questions or concerns feel free to voice them on this site or contact us directly at <strong>php@htmlandphp.com</strong></p>
<p><a href="http://www.htmlandphp.com" title="Simple easy to follow html and php video tutorials.">Visit www.HTMLandPHP.com for more information!</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.htmlandphp.com/beginner-php/introduction-to-switch-conditionals-in-php.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
<!-- This Quick Cache file was built for (  www.htmlandphp.com/feed ) in 0.98285 seconds, on May 19th, 2013 at 5:42 am UTC. -->
<!-- This Quick Cache file will automatically expire ( and be re-built automatically ) on May 19th, 2013 at 6:42 am UTC -->