
<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="http://www.thelinuxwiki.com/skins/common/feed.css?303"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://www.thelinuxwiki.com/index.php?action=history&amp;feed=atom&amp;title=Php_guide</id>
		<title>Php guide - Revision history</title>
		<link rel="self" type="application/atom+xml" href="http://www.thelinuxwiki.com/index.php?action=history&amp;feed=atom&amp;title=Php_guide"/>
		<link rel="alternate" type="text/html" href="http://www.thelinuxwiki.com/index.php?title=Php_guide&amp;action=history"/>
		<updated>2026-04-29T00:24:32Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.21.5</generator>

	<entry>
		<id>http://www.thelinuxwiki.com/index.php?title=Php_guide&amp;diff=325&amp;oldid=prev</id>
		<title>Nighthawk: Pushed from Themanclub.</title>
		<link rel="alternate" type="text/html" href="http://www.thelinuxwiki.com/index.php?title=Php_guide&amp;diff=325&amp;oldid=prev"/>
				<updated>2013-05-17T18:13:47Z</updated>
		
		<summary type="html">&lt;p&gt;Pushed from Themanclub.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&lt;br /&gt;
== Variables and Datatypes ==&lt;br /&gt;
&lt;br /&gt;
A variable is a keyword or phrase that acts as an identifier for a value stored in a system’s memory.&lt;br /&gt;
&lt;br /&gt;
'''Storing Values in a Variable'''&lt;br /&gt;
PHP lets you store nearly anything in a variable using one of the following datatypes:&lt;br /&gt;
 String: Alphanumeric characters&lt;br /&gt;
 Integer: A numeric value, expressed in whole numbers&lt;br /&gt;
 Float: A numeric value, expressed in real numbers (decimals)&lt;br /&gt;
 Boolean: Evaluates to TRUE or FALSE&lt;br /&gt;
 Array: An indexed collection of data &lt;br /&gt;
 Object: A collection of data and methods &lt;br /&gt;
&lt;br /&gt;
PHP is a loosely typed language, which means it determines the type of data being handled based on a “best guess” principle, as opposed to a strictly typed language such as C, which requires you name datatypes for every variable and function. Consider this code snippet:&lt;br /&gt;
 $foo = &amp;quot;5&amp;quot;; // This is considered a string&lt;br /&gt;
 $bar = $foo + 2; // This converts $foo to an integer (outputs 7)&lt;br /&gt;
&lt;br /&gt;
This might seem confusing at first, but it’s actually intuitive and eliminates debugging if you&lt;br /&gt;
enclose a number in quotes accidentally.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Strings ==&lt;br /&gt;
&lt;br /&gt;
A string is any series of characters enclosed in single (') or double (&amp;quot;) quotes, or that you create using&lt;br /&gt;
special heredoc or nowdoc syntax,&lt;br /&gt;
&lt;br /&gt;
'''Single-Quote Syntax'''&lt;br /&gt;
&lt;br /&gt;
doesn’t expand special characters or variables.&lt;br /&gt;
A backslash doesn't need to be escaped to print it as a regular character.&lt;br /&gt;
&lt;br /&gt;
'''Double-Quote Syntax '''&lt;br /&gt;
&lt;br /&gt;
special characters interpreted &amp;amp; variables are expanded (unless escaped)&lt;br /&gt;
&lt;br /&gt;
'''String Concatenation'''&lt;br /&gt;
done with a period (.)&lt;br /&gt;
 $foo = &amp;quot;This is a &amp;quot; . &amp;quot;string.&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
 $foo = &amp;quot;This is a &amp;quot;;&lt;br /&gt;
 $bar = &amp;quot;string.&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
both produce &lt;br /&gt;
 echo $foo . $bar;&lt;br /&gt;
 This is a string.&lt;br /&gt;
&lt;br /&gt;
PHP is a loosely typed language, it’s not necessary to declare a variable as an integer&lt;br /&gt;
&lt;br /&gt;
'''Heredoc and Nowdoc syntax'''&lt;br /&gt;
skipped...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Integers ==&lt;br /&gt;
Because PHP is a loosely typed language, it’s not necessary to declare a variable as an integer;&lt;br /&gt;
however, if you find it necessary, you can explicitly cast, or force, a value as an integer using the&lt;br /&gt;
following syntax:&lt;br /&gt;
 $foo = 27; // No quotes around a whole number always means integer&lt;br /&gt;
 $bar = (int) &amp;quot;3-peat&amp;quot; // Evaluates to 3, evaluates the numeric value if at the beginning of the string &lt;br /&gt;
 $bat = (int) &amp;quot;ten 4&amp;quot;; // Evaluates to 0, because the string doesn't start with a numeric value&lt;br /&gt;
&lt;br /&gt;
'''Floating point numbers''' are numbers with decimal values or real numbers.  They should not be used in equality comparisons.&lt;br /&gt;
&lt;br /&gt;
A '''Boolean''' value is can contain only one of two values: TRUE or FALSE. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note A string value will always evaluate to 0 unless it starts with a numeric value (such as “10 years”).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Tips ==&lt;br /&gt;
&lt;br /&gt;
Browsers don't interpret newline characters (\n), but php can.&lt;br /&gt;
&lt;br /&gt;
[[category:php]]&lt;/div&gt;</summary>
		<author><name>Nighthawk</name></author>	</entry>

	</feed>