<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="wordpress/1.5.2" -->
<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/"
>

<channel>
	<title>PhpTutorialSite.com</title>
	<link>http://phptutorialsite.com</link>
	<description>Learning Php made easier with our php tutorials</description>
	<pubDate>Wed, 19 Jul 2006 16:57:41 +0000</pubDate>
	<generator>http://wordpress.org/?v=1.5.2</generator>
	<language>en</language>

		<item>
		<title>Variable Naming - Php</title>
		<link>http://phptutorialsite.com/variable-naming-php.htm</link>
		<comments>http://phptutorialsite.com/variable-naming-php.htm#comments</comments>
		<pubDate>Wed, 19 Jul 2006 16:12:48 +0000</pubDate>
		<dc:creator>Administrator</dc:creator>
		
	<category>Intro PHP Tutorials</category>
		<guid>http://phptutorialsite.com/variable-naming-php.htm</guid>
		<description><![CDATA[	Variable Naming 
	The Variable Naming standard you choose, can be anything you want, bearing in mind that different languages have restrictions on what can be used to name variables, and some keywords are banned from being included in variable names. Some languages are also case sensitive, or insensitive,  and that also has as effect [...]]]></description>
			<content:encoded><![CDATA[	<p><strong>Variable Naming </strong></p>
	<p>The Variable Naming standard you choose, can be anything you want, bearing in mind that different languages have restrictions on what can be used to name variables, and some keywords are banned from being included in variable names. Some languages are also case sensitive, or insensitive,  and that also has as effect on variable names. <a id="more-24"></a></p>
	<p><strong> Variables in Php </strong><br />
The variable name is case-sensitive and  starts with a letter or underscore, followed by any number of letters, numbers, or underscores. </p>
	<p><strong>Variable Naming Tips </strong></p>
	<p>1) Choose a standard, that comes naturally to you, and one that will adequate describe the variable and the use of the variable. Also insure that the naming standard you choose, if you are having multiple members on your team, that everyone sticks to the same standard.<br />
$website_name = &#8220;Php Tutorial Site&#8221;;</p>
	<p>2)  Iteration and other loops, you can use the &#8220;known&#8221; variables that are associated with iterations<br />
$ index;<br />
$indx;<br />
$ndx;<br />
$n;<br />
$i;<br />
$count;<br />
$counter;</p>
	<p>While these variables do not appear descriptive, when it comes to loops, they describe the functionality very well, and that usage is commonly known in the programming world.</p>
	<p>3) Using Upper and Lower Case<br />
This helps in making the name of the variable easy to read, as it provided a break to the eyes, and help the programmer to understand that variable and it purpose. This helps to show the normal speak break that is associated when joining 2 or more words.</p>
	<p>$fullname;<br />
$FullName;<br />
$myfirstbook;<br />
$MyFirstBook;<br />
$phptutorialsite;<br />
$PhpTutorialSite;</p>
	<p>4) Using the underscore is another way to join word, and provide the natural breaks, just as we did with the Upper and Lower Case, we can also use the _  underscore, in conjunction with the Upper and Lower Case to get full effect and making the variable names easy to use.</p>
	<p>$mywebsitename=&#8221;Php Tutorial Site&#8221;<br />
$my_website_name = &#8220;Php Tutorial Site&#8221;;<br />
$MyWebsiteName = &#8220;Php Tutorial Site&#8221;<br />
$My_Website_Name= &#8220;Php Tutorial Site&#8221;</p>
	<p>Alogn with writing comments in your PHP program, having descriptive variable names is an effective technique in reducing the number of hours spent programming and debugging.</p>
]]></content:encoded>
			<wfw:commentRSS>http://phptutorialsite.com/variable-naming-php.htm/feed/</wfw:commentRSS>
	</item>
		<item>
		<title>Displaying Information - PHP</title>
		<link>http://phptutorialsite.com/displaying-information-php.htm</link>
		<comments>http://phptutorialsite.com/displaying-information-php.htm#comments</comments>
		<pubDate>Mon, 17 Jul 2006 23:47:43 +0000</pubDate>
		<dc:creator>Administrator</dc:creator>
		
	<category>Intro PHP Tutorials</category>
		<guid>http://phptutorialsite.com/displaying-information-php.htm</guid>
		<description><![CDATA[	Output Information
	We have been displaying information as we have progress through these tutorials, now we are going to take a step back and look in some detail about the different ways to display information from our php scripts
	Echo Output string (s) 
	Syntax
	echo (string str1 , [string str[]);
	Echo can be used with &#8220;&#8221;", &#8220;&#8216;&#8221;, and used [...]]]></description>
			<content:encoded><![CDATA[	<p><stong>Output Information</p>
	<p>We have been displaying information as we have progress through these tutorials, now we are going to take a step back and look in some detail about the different ways to display information from our php scripts<a id="more-23"></a></p>
	<p><strong>Echo Output string (s) </strong></p>
	<p>Syntax</p>
	<p>echo (string str1 , [string str[]);</p>
	<p>Echo can be used with &#8220;&#8221;", &#8220;&#8216;&#8221;, and used the normal escape characters, like &#8220;\n&#8221; and \&#8221; to output newline and escaping characters respectively.</p>
	<p>< ?php</p>
	<p>$my_variable = "Whoopti La";<br />
$your_variable " Ladi Dah";</p>
	<p>echo "Hello World<br />
$my_variable is on a new line,\n $your_variable is also on a new line, \n. \"I am in quotes\"."</p>
	<p>echo "\n$my_variable is not $your_variable\n";<br />
echo '$my_variable is not $your_variable';<br />
echo "\nThanks very much for using echo, now onto printf.\"';<br />
?></p>
	<p><strong> Echo Results </strong></p>
	<p>Hello World<br />
Whoopti La is on a new line,<br />
Ladi Dah is also on a new line<br />
&#8220;I am in quotes.&#8221;</p>
	<p>Whoopti La is not Ladi Dah<br />
$my_variable is not $your_variable<br />
Thanks very much for using echo, now onto printf.</p>
	<p><strong> Printf </strong><br />
Those of you who have experience with C, will be at home with <i>printf</i></p>
	<blockquote><p>
 d => Display argument as a decimal number<br />
     &#8220;%XNd&#8221; => display number D as decimal padded with N X(s)<br />
b => Display an integer as a binary number (base 2 )<br />
f =>  Display an integer as a floating-point number (double)<br />
o=>  Display an integer as an octal number (base 8 )<br />
s => Display argument as a string<br />
c => Display an integer as ASCII equivalent<br />
x => Display an integer as a lowercase hexadecimal number (base 16)<br />
X => Display an integer as an uppercase hexadecimal number (base 16)<br />
%ns => Output Spaces, where n is an integer
</p></blockquote>
	<p><strong> Sample Code </strong><br />
 < ?php<br />
 $my_number=650;<br />
 printf("Binary (Base 2): %b", $my_number );<br />
 printf("Octal (Base 8 ): %o", $my_number );<br />
 printf("Decimal (Base 10): %d", $my_number );<br />
 printf("Double: %f, $my_number );<br />
 printf("Padded Decimal: %07d", $my_number );<br />
 printf("Hex (Base 16) (lower)  : %x", $my_number );<br />
 printf("Hex (Base 16) (upper): %X", $my_number );<br />
 printf("String: %s", $my_number );<br />
 printf("%50s\n", " Right Aligned");<br />
 printf("%-50s\n", "Left Aligned");<br />
  ?></p>
	<p><strong> Printf Output </strong><br />
Binary (Base 2): 1010001010<br />
Octal (Base 8 ): 1212<br />
Decimal (Base 10): 650<br />
Double: 650.000000<br />
Padded Decimal: 0000650<br />
Hex (Base 16) (lower) : 28a<br />
Hex (Base 16) (upper): 28A<br />
String: 650</p>
	<p>                                     Right Aligned<br />
Left Aligned      </p>
	<p><strong>Using a Formatted String</strong></p>
	<p>printf() prints directly to the browswer, however in some cases, you might need to have the values stored so that we can use them within your program. Luckily you can use sprintf to format strings just like prinft() that can be used later .</p>
	<p>$hexvalue = sprintf(&#8221;%X&#8221;, 100);<br />
print &#8220;100 is $hexvalue in Hexadecimal&#8221;;</p>
	<p></stong>
</p>
]]></content:encoded>
			<wfw:commentRSS>http://phptutorialsite.com/displaying-information-php.htm/feed/</wfw:commentRSS>
	</item>
		<item>
		<title>Scope in Php</title>
		<link>http://phptutorialsite.com/scope-in-php.htm</link>
		<comments>http://phptutorialsite.com/scope-in-php.htm#comments</comments>
		<pubDate>Sat, 15 Jul 2006 08:46:02 +0000</pubDate>
		<dc:creator>Administrator</dc:creator>
		
	<category>Intro PHP Tutorials</category>
		<guid>http://phptutorialsite.com/scope-in-php.htm</guid>
		<description><![CDATA[	Php - Scope of Variables
	We just introduced functions, now along with functions comes Scope of variables.  In  common day terms, let me try to explain scope. If you have 4 tvs in different rooms,  with 4 cables box. Then each tv can show a
different channel, however, if you have 4  tvs, [...]]]></description>
			<content:encoded><![CDATA[	<p>Php - Scope of Variables</p>
	<p>We just introduced functions, now along with functions comes Scope of variables.  In  common day terms, let me try to explain scope. If you have 4 tvs in different rooms,  with 4 cables box. Then each tv can show a<br />
different channel, however, if you have 4  tvs, and 3 cables boxes and 2 tvs sharing a cable box. Then you will only have 3  different shows. So that 2 tvs share the same show and the other 2 tvs, showing their  own shows. That is how scope works..<a id="more-22"></a></p>
	<p><strong> Global Scope </strong></p>
	<p>Variable scope becomes important, when you have 2 variables with the same name, as can  easily happen within large application. It also ocurrs when you write functions to  perform specific tasks.</p>
	<p>This means that no matter where you are in the programs code, this variable will be  known and have the same value everywhere. So in our tv example, this means that all 4  tvs, are using the same cable box, so when you change a channel on any tv, all the other  tvs will change channel as well.</p>
	<p>Global variables, can be useful, but i have been taught, and i continue to believe,  that where possible you should stay away from global variables. In most cases, they are  different ways to getting around global variables, but other times, you just have to use  them.</p>
	<p><strong> Local Scope </strong></p>
	<p>Variables defined in local scope are only available within they &#8220;block&#8221;, function in  which they are defined. So outside of the function or block,  these variables will have  no value, and will be unknown.</p>
	<p>Within the scope they are defined, if they happen to be defined in another scope, then  changes made to the variable in one place will not affect what  happens in the other  function.  Back to the tv scenario again, 2 cables box, no matter what you do with one  box, unless you go and change the other box, the changes on the first box will not make  a difference.</p>
	<p><strong> Static Variables </strong></p>
	<p>Variables declared in a function, are defined everytime a function is called. So that if  the function is called and the variable is defined to be zero and the variable was  modify to be 10,when the function is called a<br />
second time, the variable goes back to  being zero when the function is called.</p>
	<p>Static variables defined in a function, remember the value of the variable, when it was  modified and uses that value everytime the function is called. So in actual fact, a  static variable within a function, always remember what it value is, so that when the  function is called again, it just continues from where it left off, and does not start  again from the declaration.</p>
	<p><strong> Examples Of Scope </strong></p>
	<p><html><br />
<head></p>
	<p></head></p>
	<p>< ?php</p>
	<p> $index = 0;<br />
 $teacher = "Joe Pulie";</p>
	<p>function print_names ($index, $newchild)<br />
{</p>
	<p> static $counter = 9;</p>
	<p> if ( $newchild == "yes")<br />
   $counter++;</p>
	<p>$teacher = "Juan Guinn";</p>
	<p> print "\nMy teacher name is $teacher\n"."<br />&#8220;;</p>
	<p> for ($index; $index< =$counter; $index++)<br />
 {<br />
    print "\nI am child $index  out of  $counter  children\n"."<br />&#8220;;<br />
 }</p>
	<p> global $teacher;</p>
	<p> print &#8220;\nMy teacher name is $teacher\n&#8221;.&#8221;<br />&#8220;;</p>
	<p>}</p>
	<p>print &#8220;<b>&#8221; .&#8221; \nHello Testing Scope\n&#8221;.&#8221;</p>
	<p></b>&#8220;;<br />
print_names($index,&#8221;no&#8221;);<br />
$index = 9;<br />
print &#8220;<br />&#8220;;<br />
print_names(9,&#8221;yes&#8221;);<br />
print &#8220;<br />&#8220;;<br />
$bindex = 5;<br />
print_names(5,&#8221;yes&#8221;);<br />
print &#8220;<br />&#8220;;<br />
?></p>
	<p>Hello Testing Scope </p>
	<p>My teacher name is Juan Guinn<br />
I am child 0 out of 9 children<br />
I am child 1 out of 9 children<br />
I am child 2 out of 9 children<br />
I am child 3 out of 9 children<br />
I am child 4 out of 9 children<br />
I am child 5 out of 9 children<br />
I am child 6 out of 9 children<br />
I am child 7 out of 9 children<br />
I am child 8 out of 9 children<br />
I am child 9 out of 9 children<br />
My teacher name is Joe Pulie </p>
	<p>My teacher name is Juan Guinn<br />
I am child 9 out of 10 children<br />
I am child 10 out of 10 children<br />
My teacher name is Joe Pulie </p>
	<p>My teacher name is Juan Guinn<br />
I am child 5 out of 11 children<br />
I am child 6 out of 11 children<br />
I am child 7 out of 11 children<br />
I am child 8 out of 11 children<br />
I am child 9 out of 11 children<br />
I am child 10 out of 11 children<br />
I am child 11 out of 11 children<br />
My teacher name is Joe Pulie </p>
	<p>Just is just touching the surface of scope, if you have any more questions, feel free to send me an email.<br />
</html>
</p>
]]></content:encoded>
			<wfw:commentRSS>http://phptutorialsite.com/scope-in-php.htm/feed/</wfw:commentRSS>
	</item>
		<item>
		<title>Php Functions</title>
		<link>http://phptutorialsite.com/php-functions.htm</link>
		<comments>http://phptutorialsite.com/php-functions.htm#comments</comments>
		<pubDate>Sat, 08 Jul 2006 13:36:18 +0000</pubDate>
		<dc:creator>Administrator</dc:creator>
		
	<category>Intro PHP Tutorials</category>
		<guid>http://phptutorialsite.com/php-functions.htm</guid>
		<description><![CDATA[	 Functions in PHP 
	Functions are the robots of any programming languages and in PHP they just the same. They are mainly used to make code reusable and easy to read. If you need to record a show on television only one time, do you program the VCR? however, if you need to record the [...]]]></description>
			<content:encoded><![CDATA[	<p><strong> Functions in PHP </strong></p>
	<p>Functions are the robots of any programming languages and in PHP they just the same. They are mainly used to make code reusable and easy to read. If you need to record a show on television only one time, do you program the VCR? however, if you need to record the same show everday, you use the timer<br />
and the programmer on the VCR to make it happen.  <a id="more-21"></a></p>
	<p><strong> Use of Functions </strong><br />
You have been using functions all along in your PHP programming without actually calling them functions. So instead of having to enter the code over and over again, you just made a simple <i> function call </i> to the already <i> defined function </i> and one you went merrily. </p>
	<p>The most important question to ask yourself when you are thinking about writing a function, is how many times am i gonna be using this same or reasonable same programming code to accomplish this task? Of if you see yourself having to use the code over and over again, then you need to put it in a function.</p>
	<p><strong> Example of a PreDefined Function </strong><br />
print( &#8220;I am a predefined function. yes i meaning PRINT&#8221;);</p>
	<p>See now, I told you that you used functions all along. Behind the scenes there is code that tells print what to do with the information is it sent i.e, What information you want to have printed.</p>
	<p><strong> Syntax of Functions </strong><br />
 A function, in simple terms takes input(argument(s)) and produces output(results(s)). The code within a function does operations on the inputs and then produces output. </p>
	<p><t><strong> Function Definition </strong></p>
	<p>function my_function ($agruement1, $agruement2, $agruement3)<br />
{<br />
         return $fctval;<br />
}</p>
	<p>The above function, takes three parameters, and then returns a value. These parameters are <i><strong>passed by value</strong>,</i>. Remember that for the future</p>
	<p>function my_other_function ()<br />
{<br />
   /* any valid php code. */<br />
}</p>
	<p>The above function, just does operations with no parameters, this can be used in many ways including writing output to the screen.</p>
	<p></t><t><strong> Function Calls </strong></p>
	<p>$returnedvalue = my_function($value1, $value2, $value3);</p>
	<p>Since my_function returns a value, we can use it in any arithmetic function, just like we would use any other variable.</p>
	<p>my_other_function();</p>
	<p>Now that is just a basic introductions to functions, we will discuss functions in more details in a future tutorial.<br />
</t>
</p>
]]></content:encoded>
			<wfw:commentRSS>http://phptutorialsite.com/php-functions.htm/feed/</wfw:commentRSS>
	</item>
		<item>
		<title>Pre/Post Increment, Decrement</title>
		<link>http://phptutorialsite.com/prepost-increment-decrement.htm</link>
		<comments>http://phptutorialsite.com/prepost-increment-decrement.htm#comments</comments>
		<pubDate>Thu, 06 Jul 2006 20:06:44 +0000</pubDate>
		<dc:creator>Administrator</dc:creator>
		
	<category>Intro PHP Tutorials</category>
		<guid>http://phptutorialsite.com/prepost-increment-decrement.htm</guid>
		<description><![CDATA[	 Pre/Post Increment, Decrement 
	We touched on these features in PHP before, now lets go a little deeper into the operation of these functions.

Examples 
	$index++; // Post-increment, Give the value of index, then increments index by one
++$index; // Pre-increment, increments index by one, then returns the valueof index 
$index&#8211;; // Post-decrement, Give the value of [...]]]></description>
			<content:encoded><![CDATA[	<p><strong> Pre/Post Increment, Decrement </strong></p>
	<p>We touched on these features in PHP before, now lets go a little deeper into the operation of these functions.<br />
<a id="more-20"></a><br />
<strong><i>Examples </i></strong></p>
	<p>$index++; // <i>Post-increment, Give the value of index, then increments index by one</i><br />
++$index; // <i>Pre-increment, increments index by one, then returns the valueof index </i><br />
$index&#8211;; // <i>Post-decrement, Give the value of index, then decreases index by one</i><br />
&#8211;$index; // <i>Pre-drecrement, decreased increments index by one, then returns the value of index</i></p>
	<p><strong> Coded Example </strong></p>
	<p>< ?php<br />
echo "Post-increment";<br />
$index = 10;<br />
echo "Index value(10): " . $index++. "\n";<br />
echo "Index value(11): " . $index .  "\n";</p>
	<p>echo "Pre-increment";<br />
$index = 10;<br />
echo "Index value(11): " . ++$index. "\n";<br />
echo "Index value(11): " . $index .  "\n";</p>
	<p>echo "Post-decrement";<br />
$index = 10;<br />
echo "Index value(10): " . $index--. "\n";<br />
echo "Index value(9): " . $index .  "\n";</p>
	<p>echo "<br />
<h3>Pre-decrement&#8221;;<br />
$index = 10;<br />
echo &#8220;Index value(9): &#8221; . &#8211;$index. &#8220;\n&#8221;;<br />
echo &#8220;Index value(9): &#8221; . $index .  &#8220;\n&#8221;;</p>
	<p>?></p>
	<p>This little features, can come in very hand, so always look for ways to simplify your code and make things easier for yourself</p>
]]></content:encoded>
			<wfw:commentRSS>http://phptutorialsite.com/prepost-increment-decrement.htm/feed/</wfw:commentRSS>
	</item>
	</channel>
</rss>
