<?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>WHAT A LAMP &#187; PHP</title> <atom:link href="http://www.whatalamp.com/category/php/feed/" rel="self" type="application/rss+xml" /><link>http://www.whatalamp.com</link> <description>Full tips on a wide range of web technology.</description> <lastBuildDate>Mon, 03 Oct 2011 16:39:47 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.1</generator> <item><title>File and Directory functions</title><link>http://www.whatalamp.com/php/file-and-directory-functions/</link> <comments>http://www.whatalamp.com/php/file-and-directory-functions/#comments</comments> <pubDate>Sun, 08 Nov 2009 21:10:37 +0000</pubDate> <dc:creator>David</dc:creator> <category><![CDATA[PHP]]></category> <category><![CDATA[Directory]]></category> <category><![CDATA[file]]></category> <category><![CDATA[filectime]]></category> <category><![CDATA[fopen]]></category> <category><![CDATA[function]]></category> <category><![CDATA[unlink]]></category><guid
isPermaLink="false">http://www.whatalamp.com/?p=356</guid> <description><![CDATA[Validating file_exists(&#8220;test.txt&#8221;); is_file(&#8220;test.txt&#8221;); is_dir(&#8220;/temp&#8221;); Checking States is_readable(&#8220;test.txt&#8221;); is_writable(&#8220;test.txt&#8221;); is_executable(&#8220;test.txt&#8221;); Determining File Size filesize(&#8220;test.txt&#8221;); Getting Date information fileatime(&#8220;test.txt&#8221;) //last accessed time filemtime(&#8220;test.txt&#8221;) // last modified time filectime(&#8220;test.txt&#8221;) // last changed time Creating file and Delete touch(&#8220;myfile.txt&#8221;) unlink(&#8220;myfile.txt&#8221;) Open file for writing, reading, appending $fp = fopen(&#8220;test.txt&#8221;, &#8220;r&#8221;); $fp = fopen(&#8220;test.txt&#8221;,&#8221;w&#8221;); $fp = fopen(&#8220;test.txt&#8221;, &#8220;a&#8221;);]]></description> <content:encoded><![CDATA[<p><strong>Validating</strong></p><p><a
href="http://www.whatalamp.com/tag/file/" class="st_tag internal_tag" rel="tag" title="Posts tagged with file">file</a>_exists(&#8220;test.txt&#8221;);</p><p>is_file(&#8220;test.txt&#8221;);</p><p>is_dir(&#8220;/temp&#8221;);</p><p><strong>Checking States</strong></p><p>is_readable(&#8220;test.txt&#8221;);</p><p>is_writable(&#8220;test.txt&#8221;);</p><p>is_executable(&#8220;test.txt&#8221;);</p><p><span
id="more-356"></span><strong>Determining File Size</strong></p><p>filesize(&#8220;test.txt&#8221;);</p><p><strong>Getting Date information</strong></p><p>fileatime(&#8220;test.txt&#8221;) //last accessed time</p><p>filemtime(&#8220;test.txt&#8221;) // last modified time</p><p><a
href="http://www.whatalamp.com/tag/filectime/" class="st_tag internal_tag" rel="tag" title="Posts tagged with filectime">filectime</a>(&#8220;test.txt&#8221;) // last changed time</p><p><strong>Creating file and Delete</strong></p><p>touch(&#8220;myfile.txt&#8221;)</p><p><a
href="http://www.whatalamp.com/tag/unlink/" class="st_tag internal_tag" rel="tag" title="Posts tagged with unlink">unlink</a>(&#8220;myfile.txt&#8221;)</p><p><strong>Open file for writing, reading, appending</strong></p><p>$fp = <a
href="http://www.whatalamp.com/tag/fopen/" class="st_tag internal_tag" rel="tag" title="Posts tagged with fopen">fopen</a>(&#8220;test.txt&#8221;, &#8220;r&#8221;);</p><p>$fp = fopen(&#8220;test.txt&#8221;,&#8221;w&#8221;);</p><p>$fp = fopen(&#8220;test.txt&#8221;, &#8220;a&#8221;);</p>]]></content:encoded> <wfw:commentRss>http://www.whatalamp.com/php/file-and-directory-functions/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Directory operation in PHP</title><link>http://www.whatalamp.com/php/directory-operation-in-php/</link> <comments>http://www.whatalamp.com/php/directory-operation-in-php/#comments</comments> <pubDate>Sat, 07 Nov 2009 19:18:45 +0000</pubDate> <dc:creator>David</dc:creator> <category><![CDATA[PHP]]></category> <category><![CDATA[closedir]]></category> <category><![CDATA[mkdir]]></category> <category><![CDATA[opendir]]></category> <category><![CDATA[readdir]]></category> <category><![CDATA[Remove]]></category> <category><![CDATA[rmdir]]></category><guid
isPermaLink="false">http://www.whatalamp.com/?p=353</guid> <description><![CDATA[Create Directory mkdir(&#8220;testdir&#8221;); Remove Directory rmdir(&#8220;testdir&#8221;); Open a Directory for Reading $dh = opendir(&#8220;testdir&#8221;); Reading the contents of Directory $dirname=&#8221;.&#8221;; $dh = opendir($dirname) or die (&#8220;Couldn&#8217;t open dir&#8221;); while(!(($file = readdir($dh)) === false)){ if (is_dir(&#8220;$dirname/$file&#8221;)){ echo &#8220;(D)&#8221;; } echo $file.&#8221;&#60;br/&#62;&#8221;; } closedir($dh);]]></description> <content:encoded><![CDATA[<p><strong>Create <a
href="http://www.whatalamp.com/tag/directory/" class="st_tag internal_tag" rel="tag" title="Posts tagged with Directory">Directory</a></strong></p><p><a
href="http://www.whatalamp.com/tag/mkdir/" class="st_tag internal_tag" rel="tag" title="Posts tagged with mkdir">mkdir</a>(&#8220;testdir&#8221;);</p><p><strong><a
href="http://www.whatalamp.com/tag/remove/" class="st_tag internal_tag" rel="tag" title="Posts tagged with Remove">Remove</a> Directory</strong></p><p><a
href="http://www.whatalamp.com/tag/rmdir/" class="st_tag internal_tag" rel="tag" title="Posts tagged with rmdir">rmdir</a>(&#8220;testdir&#8221;);</p><p><strong>Open a Directory for Reading</strong></p><p>$dh = <a
href="http://www.whatalamp.com/tag/opendir/" class="st_tag internal_tag" rel="tag" title="Posts tagged with opendir">opendir</a>(&#8220;testdir&#8221;);</p><p><span
id="more-353"></span><strong>Reading the contents of Directory</strong></p><p>$dirname=&#8221;.&#8221;;</p><p>$dh = opendir($dirname) or die (&#8220;Couldn&#8217;t open dir&#8221;);</p><p>while(!(($<a
href="http://www.whatalamp.com/tag/file/" class="st_tag internal_tag" rel="tag" title="Posts tagged with file">file</a> = <a
href="http://www.whatalamp.com/tag/readdir/" class="st_tag internal_tag" rel="tag" title="Posts tagged with readdir">readdir</a>($dh)) === false)){</p><p>if (is_dir(&#8220;$dirname/$file&#8221;)){</p><p>echo &#8220;(D)&#8221;;</p><p>}</p><p>echo $file.&#8221;&lt;br/&gt;&#8221;;</p><p>}</p><p><a
href="http://www.whatalamp.com/tag/closedir/" class="st_tag internal_tag" rel="tag" title="Posts tagged with closedir">closedir</a>($dh);</p>]]></content:encoded> <wfw:commentRss>http://www.whatalamp.com/php/directory-operation-in-php/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>File operation in PHP</title><link>http://www.whatalamp.com/php/file-operation-in-php/</link> <comments>http://www.whatalamp.com/php/file-operation-in-php/#comments</comments> <pubDate>Sat, 07 Nov 2009 09:17:29 +0000</pubDate> <dc:creator>David</dc:creator> <category><![CDATA[PHP]]></category> <category><![CDATA[fclose]]></category> <category><![CDATA[feof]]></category> <category><![CDATA[fgetc]]></category> <category><![CDATA[flock]]></category> <category><![CDATA[fopen]]></category> <category><![CDATA[fread]]></category> <category><![CDATA[fseek]]></category> <category><![CDATA[fwrite]]></category><guid
isPermaLink="false">http://www.whatalamp.com/?p=350</guid> <description><![CDATA[Open File fopen() returns false when the file can not be openned. if ($fp=fopen(&#8220;test.txt&#8221;, &#8220;w&#8221;)){ //do something } Close File fclose($fp); Reading from file fgets($fp, 1024);  // get 1024 bytes feof($fp);  // end of the file fread($fp, 16);  // get 16 bytes fseek($fp, 64);  // move point to particular byte fgetc($fp);  // get the first [...]]]></description> <content:encoded><![CDATA[<p><strong>Open <a
href="http://www.whatalamp.com/tag/file/" class="st_tag internal_tag" rel="tag" title="Posts tagged with file">File</a></strong></p><p><a
href="http://www.whatalamp.com/tag/fopen/" class="st_tag internal_tag" rel="tag" title="Posts tagged with fopen">fopen</a>() returns false when the file can not be openned.</p><p>if ($fp=fopen(&#8220;test.txt&#8221;, &#8220;w&#8221;)){</p><p>//do something</p><p>}</p><p><strong>Close File</strong></p><p><a
href="http://www.whatalamp.com/tag/fclose/" class="st_tag internal_tag" rel="tag" title="Posts tagged with fclose">fclose</a>($fp);</p><p><span
id="more-350"></span><strong>Reading from file</strong></p><p>fgets($fp, 1024);  // get 1024 bytes</p><p><a
href="http://www.whatalamp.com/tag/feof/" class="st_tag internal_tag" rel="tag" title="Posts tagged with feof">feof</a>($fp);  // end of the file</p><p><a
href="http://www.whatalamp.com/tag/fread/" class="st_tag internal_tag" rel="tag" title="Posts tagged with fread">fread</a>($fp, 16);  // get 16 bytes</p><p><a
href="http://www.whatalamp.com/tag/fseek/" class="st_tag internal_tag" rel="tag" title="Posts tagged with fseek">fseek</a>($fp, 64);  // move point to particular byte</p><p><a
href="http://www.whatalamp.com/tag/fgetc/" class="st_tag internal_tag" rel="tag" title="Posts tagged with fgetc">fgetc</a>($fp);  // get the first letter</p><p><a
href="http://www.whatalamp.com/tag/fwrite/" class="st_tag internal_tag" rel="tag" title="Posts tagged with fwrite">fwrite</a>($fp, &#8220;Hello World&#8221;);  //write into file</p><p>fputs($fp, &#8220;Hell world again&#8221;); // add into file</p><p><strong>Looking Files</strong></p><p><a
href="http://www.whatalamp.com/tag/flock/" class="st_tag internal_tag" rel="tag" title="Posts tagged with flock">flock</a>($fp, LOCK_SH); //share</p><p>flock($fp, LOCK_EX); //exclusive</p><p>flock($fp, LOCK_UN); //unlock</p>]]></content:encoded> <wfw:commentRss>http://www.whatalamp.com/php/file-operation-in-php/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>php books</title><link>http://www.whatalamp.com/php/php-books/</link> <comments>http://www.whatalamp.com/php/php-books/#comments</comments> <pubDate>Wed, 27 May 2009 18:38:26 +0000</pubDate> <dc:creator>David</dc:creator> <category><![CDATA[PHP]]></category> <category><![CDATA[book]]></category> <category><![CDATA[php books]]></category> <category><![CDATA[program]]></category><guid
isPermaLink="false">http://www.whatalamp.com/?p=333</guid> <description><![CDATA[There are hundreds of PHP books. Which one do you want, if you already have a basic knowledge of PHP? Now you know which is my suggestion.Introduction: The Basics Chapter 1: The FAQs of Life Chapter 2: Reconfiguring PHP to Do Your Bidding Chapter 3: PHP Security Chapter 4: Security Measures Chapter 5: Working with [...]]]></description> <content:encoded><![CDATA[<p>There are hundreds of <a
href="http://www.whatalamp.com/tag/php-books/" class="st_tag internal_tag" rel="tag" title="Posts tagged with php books">PHP books</a>. Which one do you want, if you already have a basic knowledge of <a
href="http://www.whatalamp.com/tag/php/" class="st_tag internal_tag" rel="tag" title="Posts tagged with PHP">PHP</a>?</p><p
align="center"><a
href="http://www.douban.com/subject/3060498/"><img
style="border:0" src="http://otho.douban.com/lpic/s3062435.jpg" alt="" /></a></p><p>Now you know which is my suggestion.<span
id="more-333"></span><strong>Introduction:</strong> The Basics<br
/> <strong>Chapter 1:</strong> The FAQs of Life<br
/> <strong>Chapter 2:</strong> Reconfiguring PHP to Do Your Bidding<br
/> <strong>Chapter 3:</strong> PHP <a
href="http://www.whatalamp.com/tag/security/" class="st_tag internal_tag" rel="tag" title="Posts tagged with security">Security</a><br
/> <strong>Chapter 4:</strong> Security Measures<br
/> <strong>Chapter 5:</strong> Working with Words and HTML<br
/> <strong>Chapter 6:</strong> Working with Dates<br
/> <strong>Chapter 7:</strong> Working with Files<br
/> <strong>Chapter 8:</strong> Tracking and Controlling Users<br
/> <strong>Chapter 9:</strong> Working with Email<br
/> <strong>Chapter 10:</strong> Working with Pictures<br
/> <strong>Chapter 11:</strong> Working with Web Pages<br
/> <strong>Chapter 12:</strong> Intermediate Tricks</p><p>It covers a lot of area of PHP programing. The tips it provides are so important and many people may omit.</p>]]></content:encoded> <wfw:commentRss>http://www.whatalamp.com/php/php-books/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Upgrade phplist to 2.10.9</title><link>http://www.whatalamp.com/php/upgrade-phplist-to-2109/</link> <comments>http://www.whatalamp.com/php/upgrade-phplist-to-2109/#comments</comments> <pubDate>Mon, 09 Feb 2009 20:02:12 +0000</pubDate> <dc:creator>David</dc:creator> <category><![CDATA[PHP]]></category> <category><![CDATA[security]]></category> <category><![CDATA[upgrade]]></category><guid
isPermaLink="false">http://www.whatalamp.com/?p=313</guid> <description><![CDATA[phplist has a very important security update. phpBB&#8217;s official site is hacked because of this issue for weeks. To upgrade phplist is simple. BACKUP your database! BACKUP your old config.php file, or optionally backup your whole PHPlist so you can rollback if something would go wrong. Replace your old PHPlist with the new version. Copy [...]]]></description> <content:encoded><![CDATA[<p>phplist has a very important <a
href="http://www.whatalamp.com/tag/security/" class="st_tag internal_tag" rel="tag" title="Posts tagged with security">security</a> update.</p><p><a
href="http://www.yinfor.com/blog/archives/2009/02/phpbb_official_site_is_hacked.html" target="_blank">phpBB&#8217;s official site is hacked</a> because of this issue for weeks.</p><p>To <a
href="http://www.whatalamp.com/tag/upgrade/" class="st_tag internal_tag" rel="tag" title="Posts tagged with upgrade">upgrade</a> phplist is simple.</p><ol
type="1"><li>BACKUP your database!</li><li>BACKUP your old config.<a
href="http://www.whatalamp.com/tag/php/" class="st_tag internal_tag" rel="tag" title="Posts tagged with PHP">php</a> <a
href="http://www.whatalamp.com/tag/file/" class="st_tag internal_tag" rel="tag" title="Posts tagged with file">file</a>, or optionally backup your whole PHPlist so you can rollback if something would go wrong.</li><li>Replace your old PHPlist with the new version.</li><li>Copy your configuration files to lists/config or re-edit the new config file.</li><li>Go to <a
class="ext" href="http://yourdomain/lists/admin/">http://yourdomain/lists/admin/</a><span
class="exttail">∞</span> and choose the <tt>Upgrade</tt> link in the <em>System Functions</em> section.</li><li>Click the link in this page.</li></ol><p><span
id="more-313"></span></p><p>The most updated one is v2.10.9.</p><p>OK. Now my list is safe and other content of this site is safe even.</p>]]></content:encoded> <wfw:commentRss>http://www.whatalamp.com/php/upgrade-phplist-to-2109/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>strpos()</title><link>http://www.whatalamp.com/php/strpos/</link> <comments>http://www.whatalamp.com/php/strpos/#comments</comments> <pubDate>Sun, 27 May 2007 07:58:06 +0000</pubDate> <dc:creator>David</dc:creator> <category><![CDATA[PHP]]></category> <category><![CDATA[function]]></category><guid
isPermaLink="false">http://ref.g2soft.net/?p=83</guid> <description><![CDATA[Using the strpos() function The strpos() function is used to search for a string or character within a string. If a match is found in the string, this function will return the position of the first match. If no match is found, it will return FALSE. Let&#8217;s see if we can find the string &#8220;world&#8221; [...]]]></description> <content:encoded><![CDATA[<p>Using the strpos() <a
href="http://www.whatalamp.com/tag/function/" class="st_tag internal_tag" rel="tag" title="Posts tagged with function">function</a></p><p>The strpos() function is used to search for a string or character within a string.</p><p>If a match is found in the string, this function will return the position of the first match. If no match is found, it will return FALSE.</p><p>Let&#8217;s see if we can find the string &#8220;world&#8221; in our string:</p><p
class="scode">&lt;?<a
href="http://www.whatalamp.com/tag/php/" class="st_tag internal_tag" rel="tag" title="Posts tagged with PHP">php</a><br
/> echo strpos(&#8220;Hello world!&#8221;,&#8221;world&#8221;);<br
/> ?&gt;</p><p>The output of the <a
href="http://www.whatalamp.com/tag/code/" class="st_tag internal_tag" rel="tag" title="Posts tagged with code">code</a> above will be:</p><p
class="scode"> 6</p><p>As you see the position of the string &#8220;world&#8221; in our string is position 6. The reason that it is 6, and not 7, is that the first position in the string is 0, and not 1.</p>]]></content:encoded> <wfw:commentRss>http://www.whatalamp.com/php/strpos/feed/</wfw:commentRss> <slash:comments>1</slash:comments> </item> <item><title>strlen()</title><link>http://www.whatalamp.com/php/strlen/</link> <comments>http://www.whatalamp.com/php/strlen/#comments</comments> <pubDate>Sat, 26 May 2007 07:55:27 +0000</pubDate> <dc:creator>David</dc:creator> <category><![CDATA[PHP]]></category> <category><![CDATA[function]]></category><guid
isPermaLink="false">http://ref.g2soft.net/?p=82</guid> <description><![CDATA[Using the strlen() function The strlen() function is used to find the length of a string. Let&#8217;s find the length of our string &#8220;Hello world!&#8221;: &#60;?php echo strlen(&#34;Hello world!&#34;); ?&#62; The output of the code above will be: 12 The length of a string is often used in loops or other functions, when it is [...]]]></description> <content:encoded><![CDATA[<p>Using the strlen() <a
href="http://www.whatalamp.com/tag/function/" class="st_tag internal_tag" rel="tag" title="Posts tagged with function">function</a></p><p>The strlen() function is used to find the length of a string.</p><p>Let&#8217;s find the length of our string &#8220;Hello world!&#8221;:</p><div
class="scode">&lt;?<a
href="http://www.whatalamp.com/tag/php/" class="st_tag internal_tag" rel="tag" title="Posts tagged with PHP">php</a><br
/> echo strlen(&quot;Hello world!&quot;);<br
/> ?&gt;</div><p>The output of the <a
href="http://www.whatalamp.com/tag/code/" class="st_tag internal_tag" rel="tag" title="Posts tagged with code">code</a> above will be:</p><div
class="scode"> 12</div><p>The length of a string is often used in loops or other functions, when it is important to know when the string ends. (i.e. in a loop, we would want to stop the loop after the last character in the string)</p>]]></content:encoded> <wfw:commentRss>http://www.whatalamp.com/php/strlen/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Strings in PHP</title><link>http://www.whatalamp.com/php/strings-in-php/</link> <comments>http://www.whatalamp.com/php/strings-in-php/#comments</comments> <pubDate>Sat, 26 May 2007 07:47:46 +0000</pubDate> <dc:creator>David</dc:creator> <category><![CDATA[PHP]]></category> <category><![CDATA[strings]]></category><guid
isPermaLink="false">http://ref.g2soft.net/?p=81</guid> <description><![CDATA[String variables are used for values that contains character strings. In this tutorial we are going to look at some of the most common functions and operators used to manipulate strings in PHP. After we create a string we can manipulate it. A string can be used directly in a function or it can be [...]]]></description> <content:encoded><![CDATA[<p>String <a
href="http://www.whatalamp.com/tag/variables/" class="st_tag internal_tag" rel="tag" title="Posts tagged with variables">variables</a> are used for values that contains character <a
href="http://www.whatalamp.com/tag/strings/" class="st_tag internal_tag" rel="tag" title="Posts tagged with strings">strings</a>.</p><p>In this tutorial we are going to look at some of the most common functions and operators used to manipulate strings in <a
href="http://www.whatalamp.com/tag/php/" class="st_tag internal_tag" rel="tag" title="Posts tagged with PHP">PHP</a>.</p><p>After we create a string we can manipulate it. A string can be used directly in a <a
href="http://www.whatalamp.com/tag/function/" class="st_tag internal_tag" rel="tag" title="Posts tagged with function">function</a> or it can be stored in a variable.</p><p>Below, the PHP script assigns the string &#8220;Hello World&#8221; to a string variable called $txt:</p><div
class="scode"> &lt;?php<br
/> $txt=&quot;Hello World&quot;;<br
/> echo $txt;<br
/> ?&gt;</div><p>The output of the <a
href="http://www.whatalamp.com/tag/code/" class="st_tag internal_tag" rel="tag" title="Posts tagged with code">code</a> above will be:</p><div
class="scode">Hello World</div><p>Now, lets try to use some different functions and operators to manipulate our string.</p><p><span
id="more-167"></span><br
/> The Concatenation Operator</p><p>There is only one string operator in PHP.</p><p>The concatenation operator (.)  is used to put two string values together.</p><p>To concatenate two variables together, use the dot (.) operator:</p><div
class="scode"> &lt;?php<br
/> $txt1=&quot;Hello World&quot;;<br
/> $txt2=&quot;1234&quot;;<br
/> echo $txt1 . &quot; &quot; . $txt2;<br
/> ?&gt;</div><p>The output of the code above will be:</p><div
class="scode"> Hello World 1234</div><p>If we look at the code above you see that we used the concatenation operator two times. This is because we had to insert a third string.</p><p>Between the two string variables we added a string with a single character, an empty space, to separate the two variables.</p>]]></content:encoded> <wfw:commentRss>http://www.whatalamp.com/php/strings-in-php/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>PHP Variables</title><link>http://www.whatalamp.com/php/php-variables/</link> <comments>http://www.whatalamp.com/php/php-variables/#comments</comments> <pubDate>Fri, 18 May 2007 23:03:51 +0000</pubDate> <dc:creator>David</dc:creator> <category><![CDATA[PHP]]></category> <category><![CDATA[variables]]></category><guid
isPermaLink="false">http://ref.g2soft.net/?p=80</guid> <description><![CDATA[A variable are used for storing a values, like text strings, numbers or arrays. When a variable is set it can be used over and over again in your script All variables in PHP start with a $ sign symbol. The correct way of setting a variable in PHP: $var_name = myvalue; New PHP programmers [...]]]></description> <content:encoded><![CDATA[<p>A variable are used for storing a values, like text <a
href="http://www.whatalamp.com/tag/strings/" class="st_tag internal_tag" rel="tag" title="Posts tagged with strings">strings</a>, numbers or arrays.</p><p>When a variable is set it can be used over and over again in your script</p><p>All <a
href="http://www.whatalamp.com/tag/variables/" class="st_tag internal_tag" rel="tag" title="Posts tagged with variables">variables</a> in <a
href="http://www.whatalamp.com/tag/php/" class="st_tag internal_tag" rel="tag" title="Posts tagged with PHP">PHP</a> start with a $ sign symbol.</p><p>The correct way of setting a variable in PHP:</p><blockquote><p>$var_name = myvalue;</p></blockquote><p>New PHP programmers often forget the $ sign at the beginning of the variable. In that case it will not work.</p><p>Let&#8217;s try creating a variable with a string, and a variable with a number:</p><blockquote><p>&lt;?php<br
/> $txt = &quot;Hello World!&quot;;<br
/> $number = 18;<br
/> ?&gt;</p></blockquote><p><span
id="more-166"></span><br
/> Variable Naming Rules</p><p>* A variable name must start with a letter or an underscore &#8220;_&#8221;<br
/> * A variable name can only contain alpha-numeric characters and underscores (a-Z, 0-9, and _ )<br
/> * A variable name should not contain spaces. If a variable name is more than one word, it should be separated with underscore ($my_string), or with capitalization ($myString)</p>]]></content:encoded> <wfw:commentRss>http://www.whatalamp.com/php/php-variables/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Escaping from HTML &#8211; php code block</title><link>http://www.whatalamp.com/php/escaping-from-html-php-code-block/</link> <comments>http://www.whatalamp.com/php/escaping-from-html-php-code-block/#comments</comments> <pubDate>Mon, 14 May 2007 18:58:28 +0000</pubDate> <dc:creator>David</dc:creator> <category><![CDATA[PHP]]></category> <category><![CDATA[code]]></category><guid
isPermaLink="false">http://ref.g2soft.net/?p=79</guid> <description><![CDATA[There are about 4 or five type of ways to put the php code into Webpage. I prefer to use following format &#60;?php echo &#039;if you want to serve XHTML or XML documents, do like this&#039;; ?&#62; via]]></description> <content:encoded><![CDATA[<p>There are about 4 or five type of ways to put the <a
href="http://www.whatalamp.com/tag/php/" class="st_tag internal_tag" rel="tag" title="Posts tagged with PHP">php</a> <a
href="http://www.whatalamp.com/tag/code/" class="st_tag internal_tag" rel="tag" title="Posts tagged with code">code</a> into Webpage.</p><p>I prefer to use following format</p><div
class="scode"> &lt;?php echo &#039;if you want to serve XHTML or XML documents, do like this&#039;; ?&gt;</div><p><a
href="http://www.php.net/manual/en/language.basic-syntax.php">via</a></p>]]></content:encoded> <wfw:commentRss>http://www.whatalamp.com/php/escaping-from-html-php-code-block/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> </channel> </rss>
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced (User agent is rejected)
Database Caching 32/84 queries in 0.259 seconds using disk: basic

Served from: www.whatalamp.com @ 2012-02-08 03:03:13 -->
