<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2enclosuresfull.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:blogger="http://schemas.google.com/blogger/2008" xmlns:georss="http://www.georss.org/georss" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0" xmlns:media="http://search.yahoo.com/mrss/" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0"><channel><atom:id>tag:blogger.com,1999:blog-7633149608386800006</atom:id><lastBuildDate>Tue, 18 Jun 2013 18:23:01 +0000</lastBuildDate><category>Others</category><category>AJAX</category><category>PHP</category><category>Tech News</category><category>.htaccess</category><category>MySQL</category><category>SEO</category><category>JavaScript</category><category>PHP Developer Journey - Tutorial</category><category>HTML</category><title>PHPHUNGER.COM - A Complete Web Developer Blog</title><description /><link>http://www.phphunger.com/</link><managingEditor>noreply@blogger.com (Samiullah Muhammed)</managingEditor><generator>Blogger</generator><openSearch:totalResults>31</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/phphunger/xvuf" /><feedburner:info uri="phphunger/xvuf" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><media:thumbnail url="http://4.bp.blogspot.com/-Bgrbg0LWx58/T-qlaUnuIbI/AAAAAAAAACg/zA8EJ_gQEAI/s1600/my_Logo%2Bcopy.png" /><media:category scheme="http://www.itunes.com/dtds/podcast-1.0.dtd">Technology/Software How-To</media:category><itunes:owner><itunes:email>noreply@blogger.com</itunes:email></itunes:owner><itunes:explicit>no</itunes:explicit><itunes:image href="http://4.bp.blogspot.com/-Bgrbg0LWx58/T-qlaUnuIbI/AAAAAAAAACg/zA8EJ_gQEAI/s1600/my_Logo%2Bcopy.png" /><itunes:subtitle></itunes:subtitle><itunes:category text="Technology"><itunes:category text="Software How-To" /></itunes:category><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7633149608386800006.post-6715335921328006610</guid><pubDate>Mon, 20 May 2013 05:25:00 +0000</pubDate><atom:updated>2013-05-19T22:25:27.444-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">SEO</category><category domain="http://www.blogger.com/atom/ns#">.htaccess</category><title>How to Redirect Visitors to a Maintenance Page During Website Maintenance Using .htaccess</title><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;br /&gt;
&lt;div style="text-align: justify;"&gt;
Sometimes we come across the websites with messages like "Website is under maintenance", "Website is temporarily shutdown", "We are upgrading our server please come back soon" etc etc. Have you ever come across such kind of things during your web surfing period? I guess everyone would have come across those situations. But have you ever imagined how to achieve this whenever your website needs such kind of work. Now let's do it.&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://4.bp.blogspot.com/-vW2CuseMOh0/UZmx4PgTTyI/AAAAAAAAAVU/Nj321_yeRO0/s1600/website-maintenance-phphunger.com.gif" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="214" src="http://4.bp.blogspot.com/-vW2CuseMOh0/UZmx4PgTTyI/AAAAAAAAAVU/Nj321_yeRO0/s320/website-maintenance-phphunger.com.gif" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div style="text-align: justify;"&gt;
Redirecting visitors to a maintenance page or other temporary page is a must have tool for every webmaster or web developer. We can redirect the visitors to a maintenance page with a simple file called as ".htaccess" file and some code in it. Now let's see the how to redirect the visitors with .htaccess code.&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style="color: #0b5394; font-size: large;"&gt;Redirecting all visitors with .htaccess&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush:html"&gt;
Options +FollowSymlinks&lt;br /&gt;
RewriteEngine on&lt;br /&gt;
RewriteCond %{REQUEST_URI} !/maintenance.html$ [NC]&lt;br /&gt;
RewriteRule .* /maintenance.html [R=302,L]&lt;br /&gt;
&lt;/pre&gt;
&lt;br /&gt;
&lt;div style="text-align: justify;"&gt;
To redirect your visitors to a maintenance page, place the above code into a .htaccess file located in your site root directory. This will make that all pages and resources contained within your domain will be redirected for visitors.&lt;/div&gt;
&lt;br /&gt;
&lt;div style="text-align: justify;"&gt;
Now that the .htaccess is in place, you'll need to create and upload your maintenance page, named 'maintenance.html' to the root directory of your site. This file can be just about anything, and does not need to be written in HTML. You can use, say, PHP to make it all dynamic, but remember to change the two instances of the file name in the .htaccess code to match the actual name of your file.&lt;/div&gt;
&lt;br /&gt;
&lt;div style="text-align: justify;"&gt;
Wow! Amazing .htaccess trick. Its working perfectly. But i have got small problem that me and my client are not able to see the site. For example, assume that you are working for a client and that client wants to see what kind of modifications are going on in the site. Then to achieve this using .htaccess add the below line of code to the file.&lt;/div&gt;
&lt;br /&gt;
&lt;pre class="brush:html"&gt;
RewriteCond %{REMOTE_ADDR} !^123\.456\.789\.000&lt;br /&gt;
&lt;/pre&gt;
&lt;br /&gt;
Now the total code looks like below.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush:html"&gt;
Options +FollowSymlinks&lt;br /&gt;
RewriteEngine on&lt;br /&gt;
RewriteCond %{REMOTE_ADDR} !^123\.456\.789\.000&lt;br /&gt;
RewriteCond %{REQUEST_URI} !/maintenance.html$ [NC]&lt;br /&gt;
RewriteRule .* /maintenance.html [R=302,L]&lt;br /&gt;
&lt;/pre&gt;
&lt;br /&gt;
&lt;div style="text-align: justify;"&gt;
&lt;b&gt;Note: &lt;/b&gt;You can add multiple IP addresses to the .htaccess file to give access to the site for the respective IP addresses. Just add the multiple RewriteCond's to the existing .htaccess file. See below code.&lt;/div&gt;
&lt;br /&gt;
&lt;pre class="brush:html"&gt;
Options +FollowSymlinks&lt;br /&gt;
RewriteEngine on&lt;br /&gt;
RewriteCond %{REMOTE_ADDR} !^123\.456\.789\.000&lt;br /&gt;
RewriteCond %{REMOTE_ADDR} !^123\.456\.789\.000&lt;br /&gt;
RewriteCond %{REMOTE_ADDR} !^123\.456\.789\.000&lt;br /&gt;
RewriteCond %{REQUEST_URI} !/maintenance.html$ [NC]&lt;br /&gt;
RewriteRule .* /maintenance.html [R=302,L]&lt;br /&gt;
&lt;/pre&gt;
&lt;br /&gt;
&lt;div style="text-align: justify;"&gt;
The above code sends all users to maintenance.html EXCEPT those with the specified IP, the IP's we mentioned in the code will be able to see the website while the remaining will see the maintenance page during website maintenance.&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
Thanks for reading this article, please feel free to comment and subscribe for more updates by putting your email in the subscribe box.&lt;/div&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/phphunger/xvuf/~4/pQmoGqvP_WY" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/phphunger/xvuf/~3/pQmoGqvP_WY/how-to-redirect-visitors-to-maintenance.html</link><author>noreply@blogger.com (Samiullah Muhammed)</author><media:thumbnail url="http://4.bp.blogspot.com/-vW2CuseMOh0/UZmx4PgTTyI/AAAAAAAAAVU/Nj321_yeRO0/s72-c/website-maintenance-phphunger.com.gif" height="72" width="72" /><thr:total>1</thr:total><feedburner:origLink>http://www.phphunger.com/2013/05/how-to-redirect-visitors-to-maintenance.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7633149608386800006.post-991050767464898202</guid><pubDate>Thu, 04 Apr 2013 05:40:00 +0000</pubDate><atom:updated>2013-05-22T22:14:32.111-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">JavaScript</category><category domain="http://www.blogger.com/atom/ns#">PHP</category><category domain="http://www.blogger.com/atom/ns#">AJAX</category><title>AJAX Auto Complete Feature Like Google, Facebook With PHP, MySQL</title><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;div style="text-align: justify;"&gt;
When i am working on one of my project, i need to work on AJAX. So i started googling about AJAX how to's. So i started learning AJAX slowly and steadily. After completion of learning AJAX i started working on &lt;b&gt;AJAX&amp;nbsp;Auto complete&amp;nbsp;suggest feature&lt;/b&gt;. So i tried hard to work on that finally i got the solution from one of the online resource. I hope you are also one of the guy who is looking for such kind of solution. So i thought i should share this to my online users. One thing every one should get this in their mind that what actually an AJAX&amp;nbsp;Auto complete&amp;nbsp;is? Perhaps i too didn't have any idea but after working on that i came to know.&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;b&gt;So let's see what an AJAX&amp;nbsp;Auto complete&amp;nbsp;suggest is?&lt;/b&gt; As a web developer almost all us in our daily life, use&amp;nbsp;Google&amp;nbsp;at its best. When we start googling like "how to" or "AJAX tutorial" etc then the&amp;nbsp;Google&amp;nbsp;will show some results beneath its search text box. See below picture for better understanding. So this feature is called as &lt;b&gt;AJAX&amp;nbsp;Auto complete&amp;nbsp;Suggest Feature&lt;/b&gt;. Now a days all of the websites have this feature.&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://1.bp.blogspot.com/-9z1V8WbpcnI/UVpuOcg93sI/AAAAAAAAAUE/_D-F-Tusvqo/s1600/ajax-autocomplete-fetaure.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="106" src="http://1.bp.blogspot.com/-9z1V8WbpcnI/UVpuOcg93sI/AAAAAAAAAUE/_D-F-Tusvqo/s320/ajax-autocomplete-fetaure.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;div&gt;
Now Let's see how to design such an application.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;span style="color: #0b5394; font-size: large;"&gt;Step 1:&amp;nbsp;&lt;/span&gt;&lt;span style="color: #0b5394; font-size: large;"&gt;Design the Database.&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;span style="color: #0b5394; font-size: large;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
See the below picture for better understanding of database design. In this tutorial, i have just created one table for demonstration purpose. The process is same for the bigger database also. In this tutorial i assumed the database name as &lt;b&gt;"phphunger_ajax_autocomplete"&lt;/b&gt; and table name as &lt;b&gt;"games"&lt;/b&gt;. Change the names as your wish.&lt;/div&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://4.bp.blogspot.com/-phc1S_ol9Sw/UVpy6pUzPOI/AAAAAAAAAUU/ervvz4j9JwM/s1600/ajax-autocomplete-db.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="139" src="http://4.bp.blogspot.com/-phc1S_ol9Sw/UVpy6pUzPOI/AAAAAAAAAUU/ervvz4j9JwM/s320/ajax-autocomplete-db.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;span style="color: #0b5394;"&gt;&lt;u&gt;Create the table as "games"&lt;/u&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;pre class="brush:html"&gt;CREATE TABLE IF NOT EXISTS `games` (
`id` int(10) NOT NULL AUTO_INCREMENT,
`name` varchar(200) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM &amp;nbsp;DEFAULT CHARSET=latin1;
&lt;/pre&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style="color: #0b5394;"&gt;&lt;b&gt;&lt;u&gt;Dump some data into the table "games"&lt;/u&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;pre class="brush:html"&gt;INSERT INTO `games` (`id`, `name`) VALUES
(1, 'Angry Birds'),
(2, 'Angry Birds Space'),
(3, 'Angry Birds Space Battle'),
(4, 'Babe Rescue'),
(5, 'Ball Defence'),
(6, 'Ball Defence &amp;nbsp;2');
&lt;/pre&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Once the database design phase is over the next step is to design the front end for the user from where he starts searching the content.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style="color: #0b5394; font-size: large;"&gt;&lt;b&gt;Step 2:&lt;/b&gt; &lt;b&gt;Design the HTML Form&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Here add one Textbox on the HTML Form which communicates with AJAX and fetches data from the&amp;nbsp;back-end&amp;nbsp;to the&amp;nbsp;front-end. See below picture how the form looks like. Name the file as "index.html"&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://3.bp.blogspot.com/-mO_vU7SW1Co/UVp4vJldK4I/AAAAAAAAAUk/cCnpu4Rynn0/s1600/ajax-autocomplete-phphunger.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="138" src="http://3.bp.blogspot.com/-mO_vU7SW1Co/UVp4vJldK4I/AAAAAAAAAUk/cCnpu4Rynn0/s320/ajax-autocomplete-phphunger.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;span style="background-color: white;"&gt;&lt;div style="text-align: justify;"&gt;&lt;/div&gt;
&lt;script type="syntaxhighlighter" class="brush:html"&gt;
&amp;lt;!DOCTYPE HTML&amp;gt;
&amp;lt;html&amp;gt;
&amp;lt;head&amp;gt;
  &amp;lt;script language=&amp;quot;JavaScript&amp;quot; type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;suggest.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;
  &amp;lt;title&amp;gt;AJAX Autocomplete With PHP - phphunger.com&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
Simple AJAX Search Suggest:
&amp;lt;form id=&amp;quot;suggestSearch&amp;quot;&amp;gt;
&amp;lt;input type=&amp;quot;text&amp;quot; id=&amp;quot;dbTxt&amp;quot; alt=&amp;quot;Search Criteria&amp;quot; onKeyUp=&amp;quot;searchSuggest();&amp;quot; autocomplete=&amp;quot;off&amp;quot;/&amp;gt;
&amp;lt;div id=&amp;quot;layer1&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;
&amp;lt;/form&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
]]&gt;&lt;/script&gt;
&lt;/span&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style="color: #0b5394; font-size: large;"&gt;Step 3: Write AJAX Code&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Write some javascript code which includes the AJAX Request, Response logic. See below code. Name the file as "suggest.js"&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style="color: #0b5394;"&gt;&lt;u&gt;suggest.js&lt;/u&gt;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;pre class="brush:html"&gt;function getXmlHttpRequestObject() {
 if (window.XMLHttpRequest) {
  return new XMLHttpRequest();
 } else if(window.ActiveXObject) {
  return new ActiveXObject("Microsoft.XMLHTTP");
 } else {
  alert("Your Browser Sucks!");
 }
}

//Our XmlHttpRequest object to get the auto suggest
var searchReq = getXmlHttpRequestObject();

//Called from keyup on the search textbox.
//Starts the AJAX request.
function searchSuggest() {
 if (searchReq.readyState == 4 || searchReq.readyState == 0) {
  var str = escape(document.getElementById('dbTxt').value);
  searchReq.open("GET", 'searchSuggest.php?search=' + str, true);
  searchReq.onreadystatechange = handleSearchSuggest;
  searchReq.send(null);
 }
}

//Called when the AJAX response is returned.
function handleSearchSuggest() {
 if (searchReq.readyState == 4) {
         var ss = document.getElementById('layer1');
  var str1 = document.getElementById('dbTxt');
  var curLeft=0;
  if (str1.offsetParent){
      while (str1.offsetParent){
   curLeft += str1.offsetLeft;
   str1 = str1.offsetParent;
      }
  }
  var str2 = document.getElementById('dbTxt');
  var curTop=20;
  if (str2.offsetParent){
      while (str2.offsetParent){
   curTop += str2.offsetTop;
   str2 = str2.offsetParent;
      }
  }
  var str =searchReq.responseText.split("\n");
  if(str.length==1)
      document.getElementById('layer1').style.visibility = "hidden";
  else
      ss.setAttribute('style','position:absolute;top:'+curTop+';left:'+curLeft+';width:250;z-index:1;padding:5px;border: 1px solid #000000; overflow:auto; height:105; background-color:#F5F5FF;');
  ss.innerHTML = '';
  for(i=0; i &amp;lt; str.length - 1; i++) {
   //Build our element string.  This is cleaner using the DOM, but
   //IE doesn't support dynamically added attributes.
   var suggest = &amp;#39;&amp;lt;div onmouseover=&amp;quot;javascript:suggestOver(this);&amp;quot; &amp;#39;;
			suggest += &amp;#39;onmouseout=&amp;quot;javascript:suggestOut(this);&amp;quot; &amp;#39;;
			suggest += &amp;#39;onclick=&amp;quot;javascript:setSearch(this.innerHTML);&amp;quot; &amp;#39;;
			suggest += &amp;#39;class=&amp;quot;small&amp;quot;&amp;gt;&amp;#39; + str[i] + &amp;#39;&amp;lt;/div&amp;gt;&amp;#39;;
			ss.innerHTML += suggest;

  }
 }
}

//Mouse over function
function suggestOver(div_value) {
 div_value.className = 'suggest_link_over';
}
//Mouse out function
function suggestOut(div_value) {
 div_value.className = 'suggest_link';
}
//Click function
function setSearch(value) {
 document.getElementById('dbTxt').value = value;
 document.getElementById('layer1').innerHTML = '';
 document.getElementById('layer1').style.visibility = "hidden";
}
&lt;/pre&gt;
&lt;br /&gt;
&lt;span style="color: #0b5394; font-size: large;"&gt;&lt;b&gt;Step 4: Connect to Database and Fetch Results.

&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
This is the file for database connection and fetching results from table. Name it as searchSuggest.php
&lt;script class="brush:html" type="syntaxhighlighter"&gt;
&lt;!doctype html&gt;
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;AJAX Autocomplete With PHP - phphunger.com&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;?php
mysql_connect("localhost", "root", "") or die(mysql_error());
mysql_select_db("phphunger_ajax_autocomplete") or die(mysql_error());

if (isset($_GET['search']) &amp;&amp; $_GET['search'] != '') {
 //Add slashes to any quotes to avoid SQL problems.
 $search = $_GET['search'];
 $suggest_query = mysql_query("SELECT distinct(name) as autosuggest FROM games WHERE name like('" .$search . "%') ORDER BY name");
 while($suggest = mysql_fetch_array($suggest_query)) {
  echo $suggest['autosuggest'] . "\n";
 }
}
?&gt;
&lt;/body&gt;
&lt;/html&gt;
&lt;/script&gt;

That's what an AJAX Autocomplete feature. Use this code snippet if your requirement matches. Do play with this code. Happy coding.
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/phphunger/xvuf/~4/UPjbOp4WlQg" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/phphunger/xvuf/~3/UPjbOp4WlQg/ajax-auto-complete-feature-like-google.html</link><author>noreply@blogger.com (Samiullah Muhammed)</author><media:thumbnail url="http://1.bp.blogspot.com/-9z1V8WbpcnI/UVpuOcg93sI/AAAAAAAAAUE/_D-F-Tusvqo/s72-c/ajax-autocomplete-fetaure.jpg" height="72" width="72" /><thr:total>2</thr:total><feedburner:origLink>http://www.phphunger.com/2013/04/ajax-auto-complete-feature-like-google.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7633149608386800006.post-8533491011875150802</guid><pubDate>Mon, 01 Apr 2013 06:28:00 +0000</pubDate><atom:updated>2013-03-31T23:28:30.897-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">PHP</category><title>Best Tools For Testing PHP Code Online</title><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;div style="text-align: justify;"&gt;
PHP is such an awesome scripting language for building dynamic web application because it has a huge user base as well as developer base. As it is an open source&amp;nbsp;language&amp;nbsp;so its freely available in the internet without any&amp;nbsp;hassle.&amp;nbsp;And the developer community is contributing towards PHP to increase the user base. Because of constantly adding new features to PHP regularly, the new and fresh tools are coming up in the internet.&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
While i am browsing for the online resources to test PHP code, i came to know these tools. So i shared these tools to you people. If want to try it once please go ahead. Its not a mandatory that you should use these tools. These tools are just for informational purpose.&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
Let's see some new tools which are providing online services for running your PHP Code. With these tools the developer can test his/her code online without going for the localhost.&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style="color: #0b5394; font-size: large;"&gt;Codepad:&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div style="text-align: justify;"&gt;
codepad is an online compiler/interpreter, and a simple collaboration tool. The codepad will support many languages like C, C++, D, Haskell, Lua, OCaml, PHP, Perl, Plain Text, Python, Ruby, Scheme, Tcl. You can try out with your favorite&amp;nbsp;language.&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://4.bp.blogspot.com/-G_1jixWi9R0/UVkgCMfRplI/AAAAAAAAATM/G_kJcNLM33M/s1600/codepad-phphunger.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="156" src="http://4.bp.blogspot.com/-G_1jixWi9R0/UVkgCMfRplI/AAAAAAAAATM/G_kJcNLM33M/s320/codepad-phphunger.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
The URL is &lt;b&gt;&lt;a href="http://codepad.org/"&gt;&lt;span style="color: #0b5394;"&gt;Codepad.org&lt;/span&gt;&lt;/a&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style="color: #0b5394; font-size: large;"&gt;Writecodeonine:&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div style="text-align: justify;"&gt;
This is also one of the online code editor where the developer can paste the code in the code area and run the code online.&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://4.bp.blogspot.com/-SFyxUSocSrw/UVkhHTjdq9I/AAAAAAAAATU/q8I_4eZS9Ao/s1600/write-code-online.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="158" src="http://4.bp.blogspot.com/-SFyxUSocSrw/UVkhHTjdq9I/AAAAAAAAATU/q8I_4eZS9Ao/s320/write-code-online.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
The URL is &lt;a href="http://writecodeonline.com/php/" rel="nofollow" target="_blank"&gt;&lt;b&gt;&lt;span style="color: #0b5394;"&gt;Writecodeonline&lt;/span&gt;&lt;/b&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="color: #0b5394; font-size: large;"&gt;&lt;b&gt;OnlinePHPFunctions:&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div style="text-align: justify;"&gt;
This online tool gives you more options like with which version of PHP you want to work. The developer can select with which version he/she wants to run their PHP code. This is most useful for testing PHP functions online. Try out once.&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://2.bp.blogspot.com/-iUyI76YFJSo/UVkiKpe4vDI/AAAAAAAAATc/ZFkSMOopxjA/s1600/online-php-functions.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="290" src="http://2.bp.blogspot.com/-iUyI76YFJSo/UVkiKpe4vDI/AAAAAAAAATc/ZFkSMOopxjA/s320/online-php-functions.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
The URL is&amp;nbsp;&lt;a href="http://sandbox.onlinephpfunctions.com/" rel="nofollow" target="_blank"&gt;&lt;b&gt;&lt;span style="color: #0b5394;"&gt;Online PHP Functions&lt;/span&gt;&lt;/b&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style="color: #0b5394; font-size: large;"&gt;codepad.viper-7:&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div style="text-align: justify;"&gt;
This tool also gives you options like with which version you wants to test the PHP code.&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://1.bp.blogspot.com/-8NKllFkRTck/UVkjLLC5TWI/AAAAAAAAATk/skuTQrz0wvc/s1600/code-viper-7.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="155" src="http://1.bp.blogspot.com/-8NKllFkRTck/UVkjLLC5TWI/AAAAAAAAATk/skuTQrz0wvc/s320/code-viper-7.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
The URL is &lt;a href="http://codepad.viper-7.com/VszfAz" rel="nofollow" target="_blank"&gt;&lt;b&gt;&lt;span style="color: #0b5394;"&gt;Codepad Viper-7&lt;/span&gt;&lt;/b&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style="color: #0b5394; font-size: large;"&gt;PHP Fiddle:&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
The PHP Fiddle is one of the amazing online code testing tool for testing almost all kind of web technologies like PHP, HTML, CSS, Javascript, MySQL support. This is one of the great tool. I simply love it.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://1.bp.blogspot.com/-6eDy2dzAaNk/UVkkwXOpNwI/AAAAAAAAATs/mt_N6GEKtME/s1600/phpfiddle.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="98" src="http://1.bp.blogspot.com/-6eDy2dzAaNk/UVkkwXOpNwI/AAAAAAAAATs/mt_N6GEKtME/s320/phpfiddle.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
The URL is &lt;a href="http://phpfiddle.org/" rel="nofollow" target="_blank"&gt;&lt;b&gt;&lt;span style="color: #0b5394;"&gt;PHP Fiddle&lt;/span&gt;&lt;/b&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style="color: #0b5394; font-size: large;"&gt;Exorithm:&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Last but not the least, its also one of the tool to test the PHP code online.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://1.bp.blogspot.com/-3PL5uAw1l90/UVklqdzqndI/AAAAAAAAAT0/5BPdrqBzGJg/s1600/exotiham.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="164" src="http://1.bp.blogspot.com/-3PL5uAw1l90/UVklqdzqndI/AAAAAAAAAT0/5BPdrqBzGJg/s320/exotiham.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
The URL is &lt;a href="http://www.exorithm.com/algorithm/sandbox" rel="nofollow" target="_blank"&gt;&lt;b&gt;&lt;span style="color: #0b5394;"&gt;Exorithm&lt;/span&gt;&lt;/b&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div style="text-align: justify;"&gt;
OK guys, Try out all these&amp;nbsp;at least&amp;nbsp;once just for informational purpose. Use our &lt;a href="http://www.phphunger.com/search/label/PHP%20Developer%20Journey%20-%20Tutorial" rel="nofollow" target="_blank"&gt;&lt;span style="color: #0b5394;"&gt;&lt;b&gt;PHP Developer Journey-Tutorials&lt;/b&gt;&lt;/span&gt;&lt;/a&gt; for testing PHP Code online. All the best.&lt;/div&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/phphunger/xvuf/~4/QetC-KcldXA" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/phphunger/xvuf/~3/QetC-KcldXA/best-tools-for-testing-php-code-online.html</link><author>noreply@blogger.com (Samiullah Muhammed)</author><media:thumbnail url="http://4.bp.blogspot.com/-G_1jixWi9R0/UVkgCMfRplI/AAAAAAAAATM/G_kJcNLM33M/s72-c/codepad-phphunger.jpg" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://www.phphunger.com/2013/03/best-tools-for-testing-php-code-online.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7633149608386800006.post-8790697739096481666</guid><pubDate>Fri, 29 Mar 2013 16:50:00 +0000</pubDate><atom:updated>2013-03-29T09:51:00.259-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">HTML</category><title>Displaying Games On the Web. How?</title><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;div style="text-align: justify;"&gt;
Hello all, today its time for me to tell you something about online games. Have you ever imagined that, in our daily life not all of us, at least some of us use to play online games with an intention to give some relief to our stressed mind. The answer will be of course, yes. But have you ever imagined that how the games you play over the web comes to you.&lt;/div&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://3.bp.blogspot.com/-IHNlrZASd5Q/UVWKYyCfqII/AAAAAAAAAS4/1jaKKpsc2oY/s1600/unity3d-dcr-swf-phphunger.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/-IHNlrZASd5Q/UVWKYyCfqII/AAAAAAAAAS4/1jaKKpsc2oY/s320/unity3d-dcr-swf-phphunger.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
Let's see how the games comes on the website. Now a days where ever you go people are addicted to playing games on the web. According to &lt;b&gt;&lt;i&gt;comScore.com&lt;/i&gt;&lt;/b&gt;, the percentage of online game players has crossed over 200 Million. Can you believe it? Now let's see in how many ways we can show the game content to the end user.
&lt;/div&gt;
&lt;br /&gt;
Generally as of now the game content has come up in 3 variety of forms. They are as follows:&lt;br /&gt;
&lt;ol style="text-align: left;"&gt;
&lt;li&gt;Adobe Flash SWF Format&lt;/li&gt;
&lt;li&gt;Adobe Shockwave Format&lt;/li&gt;
&lt;li&gt;Unity3D Format&lt;/li&gt;
&lt;/ol&gt;
&amp;nbsp;&lt;b&gt;&lt;span style="color: #3d85c6; font-size: large;"&gt;Adobe Flash SWF Format (.swf):&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div style="text-align: justify;"&gt;
This file comes up with a .swf file extension. The online gaming revolution on the web has started with this version. The inventors of this .swf file format are Adobe.

The code for displaying flash content on the web page is as follows:&lt;/div&gt;
&lt;br /&gt;
&lt;pre class="brush:html"&gt;&amp;lt;object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="100%" height="100%"&amp;gt;
    &amp;lt;param name="movie" value="swf/gamename.swf" /&amp;gt;
    &amp;lt;param name="quality" value="high" /&amp;gt;
    &amp;lt;param name="allowScriptAccess" value="always" /&amp;gt;
&amp;lt;object type="application/x-shockwave-flash" data="swf/gamename.swf" width="100%" height="100%"&amp;gt;&amp;lt;/object&amp;gt;
&amp;lt;/object&amp;gt;
&lt;/pre&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;
&lt;span style="color: #3d85c6; font-size: large;"&gt;&lt;b&gt;Adobe Shockwave Format (.dcr):&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div style="text-align: justify;"&gt;
This file comes up with a .dcr file extension. With this DCR files the 3D features has been incorporated in the online gaming revolution on the web. The inventors of this .dcr file format are also Adobe.

The code for displaying shockwave director content on the web page is as follows:
&lt;/div&gt;
&lt;br /&gt;
&lt;pre class="brush:html"&gt;&amp;lt;object width="100%" height="100%" classid="clsid:166B1BCA-3F9C-11CF-8075-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=7,0,2,0"&amp;gt;
    &amp;lt;param name="src" value="shockwave/gamename.dcr" /&amp;gt;
    &amp;lt;embed src="shockwave/gamename.dcr" width="100%" height="100%" type="application/x-director" /&amp;gt;
&amp;lt;/object&amp;gt;
&lt;/pre&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;
&lt;b&gt;&lt;span style="color: #3d85c6; font-size: large;"&gt;Unity3D Format (.unity3d):&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div style="text-align: justify;"&gt;
This file comes up with a .unity3d file extension. With this Unity3D files the 3D features has been incorporated in the online gaming revolution on the web. The gamer can feel the PC gaming experience with Unity 3D games. The inventors of this .dcr file format are also Adobe.

The code for displaying Unity 3D content on the web page is as follows:
&lt;/div&gt;
&lt;br /&gt;
&lt;pre class="brush:html"&gt;&lt;/pre&gt;
&lt;pre class="brush:html"&gt;&amp;lt;object id='UnityObject' classid='clsid:444785F1-DE89-4295-863A-D46C3A781394' width='100%' height='100%' codebase='http://webplayer.unity3d.com/download_webplayer/UnityWebPlayer.cab#version=2,0,0,0'&amp;gt;
    &amp;lt;param name='src' value='unity/gamename.unity3d' /&amp;gt;
    &amp;lt;embed src='unity/gamename.unity3d' width='100%' height='100%' type='application/vnd.unity' pluginspage='http://www.unity3d.com/unity-web-player-2.x' /&amp;gt;
&amp;lt;/object&amp;gt;
&lt;/pre&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/phphunger/xvuf/~4/kfjaELc9eds" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/phphunger/xvuf/~3/kfjaELc9eds/displaying-games-on-web-how.html</link><author>noreply@blogger.com (Samiullah Muhammed)</author><media:thumbnail url="http://3.bp.blogspot.com/-IHNlrZASd5Q/UVWKYyCfqII/AAAAAAAAAS4/1jaKKpsc2oY/s72-c/unity3d-dcr-swf-phphunger.jpg" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://www.phphunger.com/2013/03/displaying-games-on-web-how.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7633149608386800006.post-4993500399106405933</guid><pubDate>Thu, 21 Mar 2013 09:46:00 +0000</pubDate><atom:updated>2013-03-21T02:46:01.835-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">PHP Developer Journey - Tutorial</category><title>Understanding Operators in PHP - Part 5</title><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;span style="text-align: justify;"&gt;Hi all, as we are trying to understand the operators concepts. This is the last article in the Operators series. In our &lt;/span&gt;&lt;b style="text-align: justify;"&gt;&lt;u&gt;&lt;a href="http://www.phphunger.com/search/label/PHP%20Developer%20Journey%20-%20Tutorial" rel="nofollow" target="_blank"&gt;&lt;span style="color: #0b5394;"&gt;PHP Developer Journey tutorials&lt;/span&gt;&lt;/a&gt;&lt;/u&gt;&lt;/b&gt;&lt;span style="text-align: justify;"&gt;, let's continue with our Understanding Operators part 5. If you are unaware of the initial parts then please go through the below links.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;a href="http://www.phphunger.com/2012/09/understanding-operators-in-php-part-1.html" rel="nofollow" target="_blank"&gt;&lt;span style="color: #a64d79;"&gt;Assignment operators, Arithmetic operators, Array operators - Part 1&lt;/span&gt;&lt;/a&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;a href="http://www.phphunger.com/2013/02/understanding-operators-in-php-part-2.html" rel="nofollow" target="_blank"&gt;&lt;span style="color: #a64d79;"&gt;String operators, Logical Operators - Part 2&lt;/span&gt;&lt;/a&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;a href="http://www.phphunger.com/2013/02/understanding-operators-in-php-part-3.html" rel="nofollow" target="_blank"&gt;&lt;span style="color: #a64d79;"&gt;Bitwise Operators&amp;nbsp;- Part 3&lt;/span&gt;&lt;/a&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;a href="http://www.phphunger.com/2013/03/understanding-operators-in-php-part-4.html" rel="nofollow" target="_blank"&gt;&lt;span style="color: #a64d79;"&gt;Comparison Operators&amp;nbsp;- Part 4&lt;/span&gt;&lt;/a&gt;&lt;/b&gt;&lt;br /&gt;
&lt;div style="text-align: justify;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;span style="color: #0b5394; font-size: large;"&gt;&lt;b&gt;Error Control Operators:&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div style="text-align: justify;"&gt;
PHP language is very handy when dealing with errors. Sometimes its necessary for the developer not to display the error messages to the end user which actually occurs when something goes wrong with the code. This can be accomplished in PHP with the help of an operator called "Error Suppression" Operator (@).&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style="color: #0b5394;"&gt;How to use Error Control Operator (@):&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div style="text-align: justify;"&gt;
We can prevent the errors by not showing to the end user by putting in front of the operation. Like wise, for example, Divide-By-Zero is an infinity number, if you output then it will print some error. With the @ operator, however, we can prevent the error from being printed out, but not from occurring it. Let's see a simple example.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style="color: #0b5394;"&gt;Demo Without using Error Control Operator in the expression:&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;/div&gt;
&lt;pre class="brush:html"&gt;$a = 1 / 0;

echo $a;

echo "hi";
&lt;/pre&gt;
&lt;br /&gt;
From the above code, the following output will come if you execute at your localhost. See the below picture.&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://3.bp.blogspot.com/-IIJe-wjPSFg/UUlQWKVNZkI/AAAAAAAAASU/Z0j5mzMFVBc/s1600/error-control-operators-phphunger.com.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="130" src="http://3.bp.blogspot.com/-IIJe-wjPSFg/UUlQWKVNZkI/AAAAAAAAASU/Z0j5mzMFVBc/s320/error-control-operators-phphunger.com.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;b&gt;&lt;span style="color: #0b5394;"&gt;Demo With using Error Control Operator in the expression:&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush:html"&gt;@$a = 1 / 0;

echo $a;

echo "hi";&lt;/pre&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style="color: #0b5394;"&gt;Piece Of Advice for Error Control Operators:&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div style="text-align: justify;"&gt;
This operator can be very dangerous because it prevents PHP from notifying you that something has gone wrong. You should, therefore, use it only whenever you want to prevent errors from propagating to a default handler because you have a specialized code segment that you want to take care of the problem. Generally speaking, it’s a bad idea to use this approach simply as a way to “silence” the PHP interpreter, as there are better ways to do so (for example, through error logging) without compromising its error reporting capabilities.&amp;nbsp;&lt;/div&gt;
&lt;br /&gt;
&lt;div style="text-align: justify;"&gt;
Note that not all types of errors can be caught and suppressed using the @ operator. Because PHP first parses your script into an intermediate language that makes execution faster and then executes it, it won’t be capable of knowing that you have requested error suppression until the parsing phase is over and the execution phase begins. As a result, syntax errors that take place during the parsing phase will always result in an error being outputted, unless you have changed your &lt;span style="color: #0b5394;"&gt;&lt;b&gt;php.ini&lt;/b&gt;&lt;/span&gt; settings in a way that prevents all errors from being outputted independently from your use of the @ operator.
&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;/div&gt;
&lt;b&gt;&lt;span style="color: #0b5394; font-size: large;"&gt;Execution Operators:&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
PHP supports one execution operator: backticks (``). Note that these are not single-quotes! PHP will attempt to execute the contents of the backticks as a shell command; the output will be returned (i.e., it won't simply be dumped to output; it can be assigned to a variable). Use of the backtick operator is identical to shell_exec().&lt;br /&gt;
&lt;br /&gt;
As i haven't worked with this operator in my PHP's life span. So i just grabbed this content from &lt;a href="http://www.php.net/manual/en/language.operators.execution.php" rel="nofollow" target="_blank"&gt;php.net &lt;/a&gt;manual.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush:html"&gt;$output = `ls -al`;

echo "&lt;pre&gt;$output&lt;/pre&gt;
";

&lt;/pre&gt;
&lt;b&gt;&lt;span style="color: #0b5394; font-size: large;"&gt;Type casting:&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div style="text-align: justify;"&gt;
As we know PHP is a loosely typed language and assigns types to variables depending what is assigned to it.&amp;nbsp;Even though PHP handles data types automatically most of the time, you can still force it to convert a particular datum to a specific type by using a typecasting operator. There are two ways to cast a variable in PHP as a specific type: using the settype() function, or using (int) (bool) (float) etc.&amp;nbsp;&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;span style="color: #0b5394;"&gt;&lt;b&gt;Using the settype() function you can do this: These are&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;pre class="brush:html"&gt;settype($foo, "array");

settype($foo, "bool");

settype($foo, "boolean");

settype($foo, "float");

settype($foo, "int");

settype($foo, "integer");

settype($foo, "null");

settype($foo, "object");

settype($foo, "string");

&lt;/pre&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style="color: #0b5394;"&gt;Using (int) etc you can do this instead:&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;ul style="text-align: left;"&gt;
&lt;li&gt;(int) to cast a value to its integer equivalent&amp;nbsp;&lt;/li&gt;
&lt;li&gt;(float) to cast a value to its floating-point equivalent&amp;nbsp;&lt;/li&gt;
&lt;li&gt;(string) to cast a value to its string equivalent&amp;nbsp;&lt;/li&gt;
&lt;li&gt;(array) to force the conversion of the operand to an array if it is not one already&amp;nbsp;&lt;/li&gt;
&lt;li&gt;(object) to force the conversion of the operand to an object if it is not one already&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
&lt;div&gt;
&lt;pre class="brush:html"&gt;$foo = (array)$foo;

$foo = (boolean)$foo;

$foo = (double)$foo;

$foo = (float)$foo;

$foo = (int)$foo;

$foo = (integer)$foo;

$foo = (object)$foo;

$foo = (real)$foo;

$foo = (string)$foo;
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div style="text-align: justify;"&gt;
&lt;b&gt;&lt;span style="color: #0b5394;"&gt;Note:&lt;/span&gt;&lt;span style="color: #0b5394; font-size: large;"&gt; &lt;/span&gt;&lt;/b&gt;php.net manual says "PHP does not require (or support) explicit type definition in variable declaration; a variable's type is determined by the context in which the variable is used."
&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style="color: #0b5394; font-size: large;"&gt;Operator Precedence:&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div style="text-align: justify;"&gt;
Operator precedence refers to the order in which operators execute within an expression. For example, one of the basic rules of arithmetic is that multiplications and divisions are executed before additions and subtractions. With a large number of types of operations available, things get a bit more complicated, but are by no means complex.&lt;br /&gt;
&lt;br /&gt;
&lt;table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-CajegkJ2SpE/UUqstpY1wvI/AAAAAAAAASk/MUfucwr2gz0/s1600/operator-precedence-phphunger.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" src="http://1.bp.blogspot.com/-CajegkJ2SpE/UUqstpY1wvI/AAAAAAAAASk/MUfucwr2gz0/s320/operator-precedence-phphunger.jpg" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;&lt;b&gt;Operator Precedence and associvity&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;b&gt;&lt;span style="color: #0b5394;"&gt;For Example, 
&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;
&lt;pre class="brush:html"&gt;$foo = 5 * 10 - 1; // output: 49
&lt;/pre&gt;
&lt;br /&gt;
&lt;div style="text-align: justify;"&gt;
Should $foo be 49 or 45? If you cannot see why there are two possibilities, it might help to break them up using brackets, like this:

&lt;/div&gt;
&lt;br /&gt;
&lt;pre class="brush:html"&gt;$foo = (5 * 10) - 1; output: 49
$foo = 5 * (10 - 1); output: 45
&lt;/pre&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style="color: #0b5394;"&gt;Case 1: 

&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush:html"&gt;$foo = (5 * 10) - 1
&lt;/pre&gt;
&lt;br /&gt;
In case 1, five is multiplied by ten then one is subtracted from the result.&lt;br /&gt;
&lt;br /&gt;
&lt;span style="color: #0b5394;"&gt;&lt;b&gt;Case 2: 

&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush:html"&gt;$foo = 5 * (10 - 1);
&lt;/pre&gt;
&lt;br /&gt;
&lt;div style="text-align: justify;"&gt;
In case 2 ten has one subtracted from it, making nine, then that result is multiplied by five. If there is any ambiguity in your expressions, PHP will resolve them according to its internal set of rules about operator precedence, that is, which operators are calculated first.
&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
Ok that's all about operators. Keep coming for more stuff..&lt;/div&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/phphunger/xvuf/~4/7cPEzhR5fVg" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/phphunger/xvuf/~3/7cPEzhR5fVg/understanding-operators-in-php-part-5.html</link><author>noreply@blogger.com (Samiullah Muhammed)</author><media:thumbnail url="http://3.bp.blogspot.com/-IIJe-wjPSFg/UUlQWKVNZkI/AAAAAAAAASU/Z0j5mzMFVBc/s72-c/error-control-operators-phphunger.com.jpg" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://www.phphunger.com/2013/03/understanding-operators-in-php-part-5.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7633149608386800006.post-2289188532100891704</guid><pubDate>Fri, 15 Mar 2013 06:57:00 +0000</pubDate><atom:updated>2013-03-14T23:57:24.909-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">PHP Developer Journey - Tutorial</category><title>Understanding Operators in PHP - Part 4</title><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
In our &lt;a href="http://www.phphunger.com/search/label/PHP%20Developer%20Journey%20-%20Tutorial" rel="nofollow" target="_blank"&gt;&lt;span style="color: #0b5394;"&gt;&lt;b&gt;PHP Developer Journey tutorials&lt;/b&gt;&lt;/span&gt;&lt;/a&gt;, let's continue with our Understanding Operators part 4. If you are unaware of the initial parts then please go through the below links.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;a href="http://www.phphunger.com/2012/09/understanding-operators-in-php-part-1.html" rel="nofollow" target="_blank"&gt;&lt;span style="color: #a64d79;"&gt;Assignment operators, Arithmetic operators, Array operators - Part 1&lt;/span&gt;&lt;/a&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;a href="http://www.phphunger.com/2013/02/understanding-operators-in-php-part-2.html" rel="nofollow" target="_blank"&gt;&lt;span style="color: #a64d79;"&gt;String operators, Logical Operators - Part 2&lt;/span&gt;&lt;/a&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;a href="http://www.phphunger.com/2013/02/understanding-operators-in-php-part-3.html" rel="nofollow" target="_blank"&gt;&lt;span style="color: #a64d79;"&gt;Bitwise Operators&amp;nbsp;- Part 3&lt;/span&gt;&lt;/a&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style="color: #0b5394; font-size: large;"&gt;Comparison Operators:&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div style="text-align: justify;"&gt;
Comparison operators, as the name itself says that, they will allow you to compare two values. Simply the comparison operators are used to determine the relationship between two variables.&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;br /&gt;&lt;/div&gt;
Let's see the different types of comparison operators:&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style="color: #0b5394; font-size: large;"&gt;1. == (Equal):&lt;/span&gt;&amp;nbsp;&lt;/b&gt;The == operator determines if two values are equal or not.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style="color: #0b5394; font-size: large;"&gt;Demo of Equal (==) Operator:&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;pre class="brush:html"&gt;
$x = 46; // integer variable&lt;br /&gt;
$y = "46"; // string variable&lt;br /&gt;
var_dump($x == $y); // output: TRUE&lt;br /&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div style="text-align: justify;"&gt;
&lt;b&gt;Explanation:&lt;/b&gt;&amp;nbsp;From the above code, we have one integer variable and another is string variable, So &amp;nbsp;the PHP interpreter will first convert the string variable to integer variable then perform comparison. Because the integer will have the higher priority than string. So the conversion takes place before the comparison. Since the two variables hold the same values but are of different type.&amp;nbsp;&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style="color: #0b5394; font-size: large;"&gt;2. != (Not Equal):&lt;/span&gt;&amp;nbsp;&lt;/b&gt;The != operator determines if two values are different.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style="color: #0b5394; font-size: large;"&gt;Demo of&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span style="color: #0b5394; font-size: large;"&gt;Not Equal&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span style="color: #0b5394; font-size: large;"&gt;&amp;nbsp;(!=) Operator:&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;pre class="brush:html"&gt;
$x = 46;&amp;nbsp;// integer variable&lt;br /&gt;
$y = "46"; // string variable&lt;br /&gt;
var_dump($x != $y); // output: FALSE&lt;br /&gt;
&lt;/pre&gt;
&lt;br /&gt;
&lt;div style="text-align: justify;"&gt;
&lt;b&gt;Explanation:&lt;/b&gt;&amp;nbsp;From the above code, we have one integer variable and another is string variable, Since the two variables hold the same values but are of different type.&amp;nbsp;Even though&amp;nbsp;they are of different type the PHP interpreter returns FALSE.&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style="color: #0b5394; font-size: large;"&gt;3. &amp;lt; (Less than):&lt;/span&gt;&amp;nbsp;&lt;/b&gt;The &amp;lt; operator determines whether the left operand’s value is less than the right operand’s.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style="color: #0b5394; font-size: large;"&gt;Demo of&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span style="color: #0b5394; font-size: large;"&gt;Less than&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span style="color: #0b5394; font-size: large;"&gt;&amp;nbsp;(&amp;lt;) Operator:&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;pre class="brush:html"&gt;
$x = 46; //integer&lt;br /&gt;
$y = 100; //integer&lt;br /&gt;
var_dump($x&amp;lt;$y); //output: TRUE&lt;br /&gt;
&lt;/pre&gt;
&lt;br /&gt;
&lt;div style="text-align: justify;"&gt;
&lt;b&gt;Explanation:&lt;/b&gt;&amp;nbsp;From the above code, we have two integer variables, Since the two variables hold the different values but are of same type. Based on the comparison operator the&amp;nbsp;PHP interpreter returns TRUE. Since 46 is less than 100.&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style="color: #0b5394; font-size: large;"&gt;4. &amp;gt; (Greater than):&lt;/span&gt;&amp;nbsp;&lt;/b&gt;The &amp;gt; operator determines whether the left operand’s value is greater than the right operand’s.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style="color: #0b5394; font-size: large;"&gt;Demo of&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span style="color: #0b5394; font-size: large;"&gt;Greater than&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span style="color: #0b5394; font-size: large;"&gt;&amp;nbsp;(&amp;gt;) Operator:&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;pre class="brush:html"&gt;
$x = 46; //integer&lt;br /&gt;
$y = 100; //integer&lt;br /&gt;
var_dump($x&amp;gt;$y); //output: FALSE&lt;br /&gt;
&lt;/pre&gt;
&lt;br /&gt;
&lt;div style="text-align: justify;"&gt;
&lt;b&gt;Explanation:&lt;/b&gt;&amp;nbsp;From the above code, we have two integer variables, Since the two variables hold the different values but are of same type. Based on the comparison operator the&amp;nbsp;PHP interpreter returns FALSE. Since 46 is less than 100.&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style="color: #0b5394; font-size: large;"&gt;5. &amp;lt;= (Less than or Equal):&lt;/span&gt;&amp;nbsp;&lt;/b&gt;The &amp;lt;= operator determines whether the left operand’s value is less than or equal to the right operand’s.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style="color: #0b5394; font-size: large;"&gt;Demo of&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span style="color: #0b5394; font-size: large;"&gt;Less than or Equal&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span style="color: #0b5394; font-size: large;"&gt;&amp;nbsp;(&amp;lt;=) Operator:&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;pre class="brush:html"&gt;
$x = 46; //integer&lt;br /&gt;
$y = 100; //integer&lt;br /&gt;
var_dump($x&amp;lt;=$y); //output: TRUE&lt;br /&gt;
&lt;/pre&gt;
&lt;br /&gt;
&lt;div style="text-align: justify;"&gt;
&lt;b&gt;Explanation:&lt;/b&gt;&amp;nbsp;From the above code, we have two integer variables, Since the two variables hold the different values but are of same type. Based on the comparison operator the&amp;nbsp;PHP interpreter returns TRUE. Since 46 is less than or equal 100.&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style="color: #0b5394; font-size: large;"&gt;6. &amp;gt;= (Greater than or Equal):&lt;/span&gt;&amp;nbsp;&lt;/b&gt;The &amp;gt;= operator determines whether the left operand’s value is greater than the right operand’s.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style="color: #0b5394; font-size: large;"&gt;Demo of&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span style="color: #0b5394; font-size: large;"&gt;Greater than or Equal&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span style="color: #0b5394; font-size: large;"&gt;&amp;nbsp;(&amp;gt;=) Operator:&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;pre class="brush:html"&gt;
$x = 46; //integer&lt;br /&gt;
$y = 100; //integer&lt;br /&gt;
var_dump($x&amp;gt;=$y); //output: FALSE&lt;br /&gt;
&lt;/pre&gt;
&lt;br /&gt;
&lt;div style="text-align: justify;"&gt;
&lt;b&gt;Explanation:&lt;/b&gt;&amp;nbsp;From the above code, we have two integer variables, Since the two variables hold the different values but are of same type. Based on the comparison operator the&amp;nbsp;PHP interpreter returns FALSE. Since 46 is neither greater than nor equal to 100.&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style="color: #0b5394; font-size: large;"&gt;7. === (Identical):&lt;/span&gt;&lt;/b&gt; The === operator determines whether the value and the type of the two operands is the same.&lt;br /&gt;
&lt;b&gt;&lt;span style="color: #0b5394; font-size: large;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;
&lt;b&gt;&lt;span style="color: #0b5394; font-size: large;"&gt;Demo of&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span style="color: #0b5394; font-size: large;"&gt;Identical&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span style="color: #0b5394; font-size: large;"&gt;&amp;nbsp;(===) Operator:&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush:html"&gt;
$x = 46;&lt;br /&gt;
$y = "46";&lt;br /&gt;
var_dump($x===$y);&lt;br /&gt;
&lt;/pre&gt;
&lt;br /&gt;
&lt;b&gt;Explanation:&lt;/b&gt;&amp;nbsp;From the above code, we have one integer variable and another is string variable, Since the two variables hold the same values but are of different type.&amp;nbsp;The above php code returns FALSE as strict equal operator will compare both value and type of $x and $y.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style="color: #0b5394; font-size: large;"&gt;8. !== (Not Identical):&lt;/span&gt;&lt;/b&gt; The !== operator determines whether either the value or the type of the two operands is different.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style="color: #0b5394; font-size: large;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;
&lt;b&gt;&lt;span style="color: #0b5394; font-size: large;"&gt;Demo of Not&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span style="color: #0b5394; font-size: large;"&gt;Identical&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span style="color: #0b5394; font-size: large;"&gt;&amp;nbsp;(!==) Operator:&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush:html"&gt;
$x = 46;&lt;br /&gt;
$y = "46";&lt;br /&gt;
var_dump($x!==$y);&lt;br /&gt;
&lt;/pre&gt;
&lt;br /&gt;
&lt;b&gt;Explanation:&lt;/b&gt;&amp;nbsp;From the above code, we have one integer variable and another is string variable, Since the two variables hold the same values but are of different type.&amp;nbsp;The above php code returns true though their values are equal but type of $x and $y are not equal (first one is integer type and second one is character type).&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Note:&lt;/b&gt; All the comparison operators returns the&amp;nbsp;Boolean&amp;nbsp;value as a result.&lt;br /&gt;
&lt;br /&gt;
&lt;div style="text-align: justify;"&gt;
While performing comparisons with the variables, the PHP interpreter first convert them if they are not of the same type. If the variables have the same type then no&amp;nbsp;conversions&amp;nbsp;will take&amp;nbsp;place&amp;nbsp; These conversions will take place automatically by the PHP interpreter. Keep a note that, these conversions will be done based on the priority of the "Data Type". Means whatever the data type has the highest priority it will be taken first and so on. The Data Type here either integer, floating point, string, character like that.&lt;/div&gt;&lt;br/&gt;

Thanks for reading. Keep visiting for more stuff.
&lt;br /&gt;&lt;img src="http://feeds.feedburner.com/~r/phphunger/xvuf/~4/UTxN-MloRJ0" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/phphunger/xvuf/~3/UTxN-MloRJ0/understanding-operators-in-php-part-4.html</link><author>noreply@blogger.com (Samiullah Muhammed)</author><thr:total>0</thr:total><feedburner:origLink>http://www.phphunger.com/2013/03/understanding-operators-in-php-part-4.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7633149608386800006.post-3510258487103676282</guid><pubDate>Thu, 28 Feb 2013 05:05:00 +0000</pubDate><atom:updated>2013-02-27T21:08:04.415-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">MySQL</category><category domain="http://www.blogger.com/atom/ns#">PHP</category><title>Simple PHP Search Engine Script Tutorial</title><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;div style="text-align: justify;"&gt;
&lt;span style="color: #333333; font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; font-size: 13px; line-height: 19px;"&gt;Generally dynamic websites hosts tons of data with them. Searching for a particular thing is very tedious task if websites don't have proper searching&amp;nbsp;functionality. For such&amp;nbsp;requirement&amp;nbsp;this search tool is perfect if you want a quick and easy way to search your dynamic websites.&lt;/span&gt;&lt;/div&gt;
&lt;div style="color: #333333; font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; font-size: 13px; line-height: 19px;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="color: #333333; font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; font-size: 13px; line-height: 19px;"&gt;
&lt;div style="text-align: justify;"&gt;
&lt;span class="fullpost"&gt;
Having a search feature on a dynamic website is very handy for helping users find exactly what they are looking for. Almost all users now prefer different search engines to find what they are looking for. Search engines range from something very simple to very complicated as Google, MSN, Bing, Yahoo etc.&amp;nbsp;&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
In this tutorial, our scope is limited to searching a simple database table and extract those results from database. I hope it gives a little idea to build bigger search engine for developing more complex search engine like Google.&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-bSrCavzd818/US3j4YpFlRI/AAAAAAAAAQ0/GqrdxKpuWkc/s1600/search.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="160" src="http://4.bp.blogspot.com/-bSrCavzd818/US3j4YpFlRI/AAAAAAAAAQ0/GqrdxKpuWkc/s320/search.jpg" width="320" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;Simple PHP Search Engine Script Tutorial&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;div style="color: #333333; font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; font-size: 13px; line-height: 19px;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="color: #333333; font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; font-size: 13px; line-height: 19px;"&gt;
&lt;div style="text-align: justify;"&gt;
This tutorial assumes whatever the data you want to search will be stored in the MySQL Database table. In this tutorial, we will use a simple query to search the data from the MySQL database table. No complex algorithms will be used. Using of such complex algorithms is beyond our tutorial's limit.&lt;/div&gt;
&lt;/div&gt;
&lt;div style="color: #333333; font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; font-size: 13px; line-height: 19px;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="color: #333333; font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; font-size: 13px; line-height: 19px;"&gt;
Before we start off this tutorial, we need a database. The code below will create a testing database to use as you work through the tutorial.&lt;/div&gt;
&lt;div style="color: #333333; font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; font-size: 13px; line-height: 19px;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div style="color: #333333; font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; font-size: 13px; line-height: 19px;"&gt;
&amp;nbsp;&lt;strong&gt;Step 1:&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
Creating a database called&amp;nbsp;&lt;em&gt;&lt;strong&gt;"search-engine"&lt;/strong&gt;&lt;/em&gt;&amp;nbsp;and table called&amp;nbsp;&lt;em&gt;&lt;strong&gt;"mobiles"&lt;/strong&gt;&lt;/em&gt;. See below picture and code snippet.&lt;/div&gt;
&lt;div style="color: #333333; font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; font-size: 13px; line-height: 19px;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="color: #333333; font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; font-size: 13px; line-height: 19px; margin-left: auto; margin-right: auto; text-align: center;"&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-OmNty43EwV8/US3oJaA0zNI/AAAAAAAAARE/zVKm47BBIzw/s1600/search-engine-database-phphunger.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="120" src="http://4.bp.blogspot.com/-OmNty43EwV8/US3oJaA0zNI/AAAAAAAAARE/zVKm47BBIzw/s320/search-engine-database-phphunger.jpg" width="320" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;PHP Search Engine Database&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;
&lt;script type="syntaxhighlighter" class="brush:html"&gt;
CREATE DATABASE search-engine;

CREATE TABLE IF NOT EXISTS `mobiles` (
  `id` int(10) NOT NULL AUTO_INCREMENT,
  `name` varchar(50) NOT NULL,
  `type` varchar(50) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=7 ;

INSERT INTO `mobiles` (`id`, `name`, `type`) VALUES
(1, 'Samsung Wave', 'Bada OS'),
(2, 'Samsung Note', 'Android'),
(3, 'Nokia Lumia', 'Windows OS'),
(4, 'IPhone', 'IOS'),
(5, 'Motorola', 'Android'),
(6, 'Samsung Galaxy', 'Android');
&lt;/script&gt;

&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;b&gt;Step 2:&amp;nbsp;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Now create a search form &lt;b&gt;(index.php)&lt;/b&gt; for the users where they start searching for their desired content. See the below code snippet.&lt;br /&gt;

&lt;script type="syntaxhighlighter" class="brush:html"&gt;
&lt;!doctype html&gt;
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Simple PHP Search Engine - phphunger.com&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;form action="search.php" method="get" &gt;
Please search here:
    &lt;input type="text" name="query" id="text"  /&gt;
 &lt;input type="submit" name="submit" id="search" value="Search" /&gt;
&lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;
&lt;/script&gt;

&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;b&gt;Step 3:&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
The real search script where the real search functionality happens. Name it as &lt;b&gt;(search.php)&lt;/b&gt; or whatever it may be. See the below code snippet.&lt;br /&gt;
&lt;script type="syntaxhighlighter" class="brush:html"&gt;
&lt;!doctype html&gt;
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Simple PHP Search Engine - phphunger.com&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;?php
    mysql_connect("localhost", "root", "") or die("Error connecting to database: ".mysql_error());
    mysql_select_db("search-engine") or die(mysql_error());
    $query = $_GET['query']; 
    $min_length = 3;
  if(strlen($query) &gt;= $min_length)
  { 
        $query = htmlspecialchars($query); 
        $query = mysql_real_escape_string($query);  
  echo "&lt;table border='0' width='300' align='center' cellpadding='1' cellspacing='1'&gt;";
  echo "&lt;tr&gt;&lt;h3&gt;You have searched for $query...Please find the details of $query...&lt;/h3&gt;&lt;/tr&gt;";
  echo "&lt;tr align='center' bgcolor='#03acfa' &gt; &lt;td height='35px' width='150px'&gt;&lt;b&gt;Mobile Name&lt;/b&gt;&lt;/td&gt; &lt;td&gt;&lt;b&gt;Mobile Type&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;";     
        $result = mysql_query("SELECT * FROM mobiles WHERE (`name` LIKE '%".$query."%') OR (`type` LIKE '%".$query."%')") or die(mysql_error()); 
        if(mysql_num_rows($result) &gt; 0)
  {
            while($results = mysql_fetch_array($result))
   { 
                echo "&lt;tr align='center' bgcolor='#93dafb'&gt;&lt;td height='25px'&gt;".$results['name']."&lt;/td&gt; &lt;td&gt;".$results['type']."&lt;/td&gt;&lt;/tr&gt;" ;
            }
          
        }
        else{ 
            echo "&lt;tr align='center' bgcolor='#fdee03'&gt;&lt;td colspan='2' height='25px'&gt;Sorry..No results for $query&lt;/td&gt;&lt;tr&gt;"; 
   echo "&lt;/table&gt;";  
        }   
    }
    else{ 
        echo "Your search keyword contains letters only ".$min_length;
    }
?&gt;
&lt;/body&gt;
&lt;/html&gt;
&lt;/script&gt;
&lt;div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://1.bp.blogspot.com/-GdMbQGad0rs/US39ranOieI/AAAAAAAAARY/es4c7QMLYw0/s1600/php-search-engine-details.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="202" src="http://1.bp.blogspot.com/-GdMbQGad0rs/US39ranOieI/AAAAAAAAARY/es4c7QMLYw0/s320/php-search-engine-details.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
The above is the combined screen shot how you will see the results after searching for something. Hope you have enjoyed it. Keep coming for more tutorials.&amp;nbsp;
&lt;/div&gt;
&lt;/div&gt;
&lt;/span&gt;&lt;img src="http://feeds.feedburner.com/~r/phphunger/xvuf/~4/nc1RxqemF0w" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/phphunger/xvuf/~3/nc1RxqemF0w/simple-php-search-engine-script-tutorial.html</link><author>noreply@blogger.com (Samiullah Muhammed)</author><media:thumbnail url="http://4.bp.blogspot.com/-bSrCavzd818/US3j4YpFlRI/AAAAAAAAAQ0/GqrdxKpuWkc/s72-c/search.jpg" height="72" width="72" /><thr:total>8</thr:total><feedburner:origLink>http://www.phphunger.com/2013/02/simple-php-search-engine-script-tutorial.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7633149608386800006.post-2873664355836132066</guid><pubDate>Mon, 25 Feb 2013 11:37:00 +0000</pubDate><atom:updated>2013-03-22T22:06:32.153-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">PHP Developer Journey - Tutorial</category><title>Understanding Operators in PHP - Part 3</title><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;div dir="ltr" style="text-align: left;"&gt;
&lt;div dir="ltr" style="text-align: left;"&gt;
&lt;div style="text-align: justify;"&gt;
Hi all, let's continue with our operators. The next in the series is Bitwise operators:&lt;strong&gt;Note:&lt;/strong&gt; Please go through &lt;a href="http://www.phphunger.com/2012/09/understanding-operators-in-php-part-1.html#.UStMiR2dcbs" rel="nofollow" target="_blank"&gt;&lt;strong&gt;&lt;span style="color: #0b5394;"&gt;part 1&lt;/span&gt;&lt;/strong&gt;&lt;/a&gt; and &lt;a href="http://www.phphunger.com/2013/02/understanding-operators-in-php-part-2.html#.UStMix2dcbs" rel="nofollow" target="_blank"&gt;&lt;strong&gt;&lt;span style="color: #0b5394;"&gt;part 2&lt;/span&gt;&lt;/strong&gt;&lt;/a&gt; of php operators here.

&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;strong&gt;&lt;span style="font-size: large;"&gt;
&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;strong&gt;&lt;span style="font-size: large;"&gt;Bitwise operators:&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;
&lt;strong&gt;&lt;span style="font-size: large;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;strong&gt;&lt;span style="font-size: large;"&gt;
&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
Bitwise operators works on the binary representation of integers. Means first the integer operand will be converted to its binary form and then performs its operation based on the operator.&lt;br /&gt;
&lt;strong&gt;&lt;br /&gt;&lt;/strong&gt;
&lt;strong&gt;Note:&lt;/strong&gt; The binary form means zero's(0) and one's(1).&lt;br /&gt;
&lt;br /&gt;
The bitwise operators are as follows:

&amp;amp; (AND), | (OR), ^ (XOR), ~ (NOT), &amp;lt;&amp;lt; (Shift Left), &amp;gt;&amp;gt; (Shift Right)&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;&lt;span style="font-size: large;"&gt;Bitwise AND (&amp;amp;) :&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
If both the bits are set, means both the binary values are 1 then the output will be 1 else 0. Here the bit set means 1 and bit not set means 0. Let's see a small demo on bitwise AND (&amp;amp;).&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Demo:&lt;/strong&gt;&lt;br /&gt;
&lt;span class="fullpost"&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span class="fullpost"&gt;
Let's take two numbers 46 and 93 respectively. Now perform binary conversion for these two numbers.&lt;/span&gt;&lt;br /&gt;
&lt;span class="fullpost"&gt;&lt;strong&gt;&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;
&lt;span class="fullpost"&gt;&lt;strong&gt;Step 1:&lt;/strong&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span class="fullpost"&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span class="fullpost"&gt;Converting decimal numbers 46 and 93 into their binary form.&amp;nbsp;
&lt;/span&gt;&lt;br /&gt;
&lt;span class="fullpost"&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span class="fullpost"&gt;The binary representation of 46 - 00101110&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span class="fullpost"&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span class="fullpost"&gt;The binary representation of 93 - 01011101&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span class="fullpost"&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span class="fullpost"&gt;I guess you are little bit confused with the binary form. How the decimal numbers got translated to binary form. You are not alone, even i too confused with these binary form. After&amp;nbsp;recollecting&amp;nbsp;my engineering subjects i got clear solution. See the below tables about how to convert decimal number to binary conversion?&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span class="fullpost"&gt;&lt;strong&gt;&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;
&lt;span class="fullpost"&gt;&lt;strong&gt;A decimal number 46 can be represent in binary form like bellow -&amp;nbsp;&lt;/strong&gt;

&lt;/span&gt;&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;table&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;th colspan="11"&gt;1 Byte ( 8 bits )&lt;/th&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Decimal Place&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;128&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;64&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;32&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;16&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;8&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;4&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;2&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;1&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;2&lt;sup&gt;7&lt;/sup&gt;&lt;/td&gt;
&lt;td&gt;2&lt;sup&gt;6&lt;/sup&gt;&lt;/td&gt;
&lt;td&gt;2&lt;sup&gt;5&lt;/sup&gt;&lt;/td&gt;
&lt;td&gt;2&lt;sup&gt;4&lt;/sup&gt;&lt;/td&gt;
&lt;td&gt;2&lt;sup&gt;3&lt;/sup&gt;&lt;/td&gt;
&lt;td&gt;2&lt;sup&gt;2&lt;/sup&gt;&lt;/td&gt;
&lt;td&gt;2&lt;sup&gt;1&lt;/sup&gt;&lt;/td&gt;
&lt;td&gt;2&lt;sup&gt;0&lt;/sup&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;32&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;8&lt;/td&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;=&lt;/td&gt;
&lt;td&gt;46&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;br /&gt;
&lt;strong&gt;A decimal number 93 can be represent in binary form like bellow -&amp;nbsp;&lt;/strong&gt;&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;table class="table table-bordered"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;th colspan="11"&gt;1 Byte ( 8 bits )&lt;/th&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Decimal Place&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;128&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;64&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;32&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;16&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;8&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;4&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;2&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;1&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;2&lt;sup&gt;7&lt;/sup&gt;&lt;/td&gt;
&lt;td&gt;2&lt;sup&gt;6&lt;/sup&gt;&lt;/td&gt;
&lt;td&gt;2&lt;sup&gt;5&lt;/sup&gt;&lt;/td&gt;
&lt;td&gt;2&lt;sup&gt;4&lt;/sup&gt;&lt;/td&gt;
&lt;td&gt;2&lt;sup&gt;3&lt;/sup&gt;&lt;/td&gt;
&lt;td&gt;2&lt;sup&gt;2&lt;/sup&gt;&lt;/td&gt;
&lt;td&gt;2&lt;sup&gt;1&lt;/sup&gt;&lt;/td&gt;
&lt;td&gt;2&lt;sup&gt;0&lt;/sup&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;64&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;16&lt;/td&gt;
&lt;td&gt;8&lt;/td&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;=&lt;/td&gt;
&lt;td&gt;93&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;/div&gt;
&lt;strong&gt;Step 2:&lt;/strong&gt;
&lt;br /&gt;
&lt;strong&gt;&lt;br /&gt;&lt;/strong&gt;
&lt;br /&gt;
&lt;div style="text-align: justify;"&gt;
Now perform Bitwise AND Operation on them. The output will be 00001100.&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
After performing AND operation on both the binary numbers, the bit set occurs at 5th digit and 6th digit in both the binary forms. So the 5th digit is at 2&lt;sup&gt;3&lt;/sup&gt; and 6th digit is at 2&lt;sup&gt;2&lt;/sup&gt; position. Now you may get confusion that how to perform the Bitwise Operation on those numbers. Simply perform the AND operation then you will get the result. See below that how to perform bitwise operation on those two numbers.&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;/div&gt;
&lt;table&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;Base 2&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;2&lt;sup&gt;7&lt;/sup&gt;&lt;/td&gt;
&lt;td&gt;2&lt;sup&gt;6&lt;/sup&gt;&lt;/td&gt;
&lt;td&gt;2&lt;sup&gt;5&lt;/sup&gt;&lt;/td&gt;
&lt;td&gt;2&lt;sup&gt;4&lt;/sup&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;2&lt;sup&gt;3&lt;/sup&gt;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;2&lt;sup&gt;2&lt;/sup&gt;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;2&lt;sup&gt;1&lt;/sup&gt;&lt;/td&gt;
&lt;td&gt;2&lt;sup&gt;0&lt;/sup&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;Binary 46&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;1&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;1&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;Binary 93&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;1&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;1&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;Result&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;1&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;1&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;br /&gt;
Now from the above manipulation, the bit set occurs 5th and 6th position.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Step 3:&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
Now perform addition operation on these two 2&lt;sup&gt;3&lt;/sup&gt; and 6th digit is at 2&lt;sup&gt;2&lt;/sup&gt;. You will get 2&lt;sup&gt;3&lt;/sup&gt; + 2&lt;sup&gt;2&lt;/sup&gt; = 12.

Now you may be confused that how this answer 12 came. Don't get confused. Simply multiply the binary number quotient with base 2 and then perform addition on those numbers then you will get the answer.
&lt;br /&gt;
&lt;br /&gt;
&lt;table&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;(2&lt;sup&gt;7&lt;/sup&gt; x 0)&lt;/td&gt;
&lt;td&gt;+&lt;/td&gt;
&lt;td&gt;(2&lt;sup&gt;6&lt;/sup&gt; x 0)&lt;/td&gt;
&lt;td&gt;+&lt;/td&gt;
&lt;td&gt;(2&lt;sup&gt;5&lt;/sup&gt; x 0)&lt;/td&gt;
&lt;td&gt;+&lt;/td&gt;
&lt;td&gt;(2&lt;sup&gt;4&lt;/sup&gt; x 0)&lt;/td&gt;
&lt;td&gt;+&lt;/td&gt;
&lt;td&gt;(2&lt;sup&gt;3&lt;/sup&gt; x 1)&lt;/td&gt;
&lt;td&gt;+&lt;/td&gt;
&lt;td&gt;(2&lt;sup&gt;2&lt;/sup&gt; x 1)&lt;/td&gt;
&lt;td&gt;+&lt;/td&gt;
&lt;td&gt;(2&lt;sup&gt;1&lt;/sup&gt; x 0)&lt;/td&gt;
&lt;td&gt;+&lt;/td&gt;
&lt;td&gt;(2&lt;sup&gt;0&lt;/sup&gt; x 0)&lt;/td&gt;
&lt;td&gt;= 12&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;br /&gt;
Huh...These many steps...its really very frustrating..Don't panic..you don't have to worry about these many steps. Let's see the same in our php code. Its really very simple.
&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush:html"&gt;$x=46;

$y=93;

echo $x &amp;amp; $y; // output: 12&lt;/pre&gt;
&lt;pre class="brush:html"&gt;&lt;/pre&gt;
&lt;strong&gt;&lt;span style="font-size: large;"&gt;Bitwise OR (|) :&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
If any one of the bit is set, means any one of the binary value is 1 then the output will be 1 else 0. Here the bit set means 1 and bit not set means 0. Let's see a small demo on bitwise OR (|).&lt;br /&gt;
&lt;strong&gt;&lt;br /&gt;&lt;/strong&gt;
&lt;strong&gt;Demo:&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
Let's take two numbers 46 and 93 respectively. Now perform binary conversion for these two numbers.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Step 1:&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
Converting decimal numbers 46 and 93 into their binary form.&amp;nbsp;
&lt;br /&gt;
&lt;br /&gt;
The binary representation of 46 - 00101110&lt;br /&gt;
&lt;br /&gt;
The binary representation of 93 - 01011101&lt;br /&gt;
&lt;br /&gt;
&lt;span style="text-align: justify;"&gt;I guess you are little bit confused with the binary form. How the decimal numbers got translated to binary form. You are not alone, even i too confused with these binary form. After&amp;nbsp;recollecting&amp;nbsp;my engineering subjects i got clear solution. See the below tables about how to convert decimal number to binary conversion?&lt;/span&gt;&lt;br /&gt;
&lt;span style="text-align: justify;"&gt;&lt;br /&gt;&lt;/span&gt;
&lt;strong&gt;A decimal number 46 can be represent in binary form like bellow - &lt;/strong&gt;
&lt;br /&gt;
&lt;table&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;th colspan="11"&gt;1 Byte ( 8 bits )&lt;/th&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Decimal Place&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;128&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;64&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;32&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;16&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;8&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;4&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;2&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;1&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;2&lt;sup&gt;7&lt;/sup&gt;&lt;/td&gt;
&lt;td&gt;2&lt;sup&gt;6&lt;/sup&gt;&lt;/td&gt;
&lt;td&gt;2&lt;sup&gt;5&lt;/sup&gt;&lt;/td&gt;
&lt;td&gt;2&lt;sup&gt;4&lt;/sup&gt;&lt;/td&gt;
&lt;td&gt;2&lt;sup&gt;3&lt;/sup&gt;&lt;/td&gt;
&lt;td&gt;2&lt;sup&gt;2&lt;/sup&gt;&lt;/td&gt;
&lt;td&gt;2&lt;sup&gt;1&lt;/sup&gt;&lt;/td&gt;
&lt;td&gt;2&lt;sup&gt;0&lt;/sup&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;32&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;8&lt;/td&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;=&lt;/td&gt;
&lt;td&gt;46&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;br /&gt;
&lt;strong&gt;A decimal number 93 can be represent in binary form like bellow - &lt;/strong&gt;
&lt;br /&gt;
&lt;table class="table table-bordered"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;th colspan="11"&gt;1 Byte ( 8 bits )&lt;/th&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Decimal Place&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;128&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;64&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;32&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;16&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;8&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;4&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;2&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;1&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;2&lt;sup&gt;7&lt;/sup&gt;&lt;/td&gt;
&lt;td&gt;2&lt;sup&gt;6&lt;/sup&gt;&lt;/td&gt;
&lt;td&gt;2&lt;sup&gt;5&lt;/sup&gt;&lt;/td&gt;
&lt;td&gt;2&lt;sup&gt;4&lt;/sup&gt;&lt;/td&gt;
&lt;td&gt;2&lt;sup&gt;3&lt;/sup&gt;&lt;/td&gt;
&lt;td&gt;2&lt;sup&gt;2&lt;/sup&gt;&lt;/td&gt;
&lt;td&gt;2&lt;sup&gt;1&lt;/sup&gt;&lt;/td&gt;
&lt;td&gt;2&lt;sup&gt;0&lt;/sup&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;64&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;16&lt;/td&gt;
&lt;td&gt;8&lt;/td&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;=&lt;/td&gt;
&lt;td&gt;93&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;/div&gt;
&lt;strong&gt;Step 2:&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
Now perform Bitwise OR Operation on them. The output will be 01111111.
&lt;br /&gt;
&lt;br /&gt;
&lt;div style="text-align: justify;"&gt;
After performing OR operation on both the binary numbers, the bit set occurs at 2nd, 3rd, 4th, 5th, 6th, 7th and 8th digits respectively in both the binary forms. So these digits are at 2&lt;sup&gt;6&lt;/sup&gt;,2&lt;sup&gt;5&lt;/sup&gt;,2&lt;sup&gt;4&lt;/sup&gt;,2&lt;sup&gt;3&lt;/sup&gt;,2&lt;sup&gt;2&lt;/sup&gt;,2&lt;sup&gt;1&lt;/sup&gt;,and at 2&lt;sup&gt;0&lt;/sup&gt; positions. Now you may get confusion that how to perform the Bitwise Operation on those numbers. Simply perform the OR operation then you will get the result. See below that how to perform bitwise operation on those two numbers.&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;/div&gt;
&lt;table&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;Base 2&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;2&lt;sup&gt;7&lt;/sup&gt;&lt;/td&gt;
&lt;td&gt;2&lt;sup&gt;6&lt;/sup&gt;&lt;/td&gt;
&lt;td&gt;2&lt;sup&gt;5&lt;/sup&gt;&lt;/td&gt;
&lt;td&gt;2&lt;sup&gt;4&lt;/sup&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;2&lt;sup&gt;3&lt;/sup&gt;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;2&lt;sup&gt;2&lt;/sup&gt;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;2&lt;sup&gt;1&lt;/sup&gt;&lt;/td&gt;
&lt;td&gt;2&lt;sup&gt;0&lt;/sup&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;Binary 46&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;1&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;1&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;Binary 93&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;1&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;1&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;Result&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;1&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;1&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;br /&gt;
Now from the above manipulation, the bit set occurs at 2nd, 3rd, 4th, 5th, 6th, 7th, and 8th positions respectively.

&lt;br /&gt;
&lt;strong&gt;&lt;br /&gt;&lt;/strong&gt;
&lt;strong&gt;Step 3:&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
Now perform addition operation on these 2&lt;sup&gt;6&lt;/sup&gt;,2&lt;sup&gt;5&lt;/sup&gt;,2&lt;sup&gt;4&lt;/sup&gt;,2&lt;sup&gt;3&lt;/sup&gt;,2&lt;sup&gt;2&lt;/sup&gt;,2&lt;sup&gt;1&lt;/sup&gt;,and at 2&lt;sup&gt;0&lt;/sup&gt; positions. You will get = 127.

Now you may be confused that how this answer 127 came. Don't get confused. Simply multiply the binary number quotient with base 2 and then perform addition on those numbers then you will get the answer.
&lt;br /&gt;
&lt;br /&gt;
&lt;table&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;(2&lt;sup&gt;7&lt;/sup&gt; x 0)&lt;/td&gt;
&lt;td&gt;+&lt;/td&gt;
&lt;td&gt;(2&lt;sup&gt;6&lt;/sup&gt; x 1)&lt;/td&gt;
&lt;td&gt;+&lt;/td&gt;
&lt;td&gt;(2&lt;sup&gt;5&lt;/sup&gt; x 1)&lt;/td&gt;
&lt;td&gt;+&lt;/td&gt;
&lt;td&gt;(2&lt;sup&gt;4&lt;/sup&gt; x 1)&lt;/td&gt;
&lt;td&gt;+&lt;/td&gt;
&lt;td&gt;(2&lt;sup&gt;3&lt;/sup&gt; x 1)&lt;/td&gt;
&lt;td&gt;+&lt;/td&gt;
&lt;td&gt;(2&lt;sup&gt;2&lt;/sup&gt; x 1)&lt;/td&gt;
&lt;td&gt;+&lt;/td&gt;
&lt;td&gt;(2&lt;sup&gt;1&lt;/sup&gt; x 1)&lt;/td&gt;
&lt;td&gt;+&lt;/td&gt;
&lt;td&gt;(2&lt;sup&gt;0&lt;/sup&gt; x 1)&lt;/td&gt;
&lt;td&gt;= 127&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;br /&gt;
Huh...These many steps...its really very frustrating..Don't panic..you don't have to worry about these many steps. Let's see the same in our php code. Its really very simple.
&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush:html"&gt;$x=46;

$y=93;

echo $x | $y; // output: 127&lt;/pre&gt;
&lt;pre class="brush:html"&gt;&lt;/pre&gt;
&lt;strong&gt;&lt;span style="font-size: large;"&gt;Bitwise XOR (^) :&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
If any one of the bit is set, means any of the binary value is 1 then the output will be 1. If both the bits are either 1 or 0 then output will be 0.
Here the bit set means 1 and bit not set means 0. Let's see a small demo on bitwise XOR (^).&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Demo:&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
Let's take two numbers 46 and 93 respectively. Now perform binary conversion for these two numbers.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Step 1:&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
Converting decimal numbers 46 and 93 into their binary form.&amp;nbsp;
&lt;br /&gt;
&lt;br /&gt;
The binary representation of 46 - 00101110&lt;br /&gt;
&lt;br /&gt;
The binary representation of 93 - 01011101&lt;br /&gt;
&lt;strong&gt;&lt;br /&gt;&lt;/strong&gt;
&lt;strong&gt;A decimal number 46 can be represent in binary form like bellow - &lt;/strong&gt;
&lt;br /&gt;
&lt;table&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;th colspan="11"&gt;1 Byte ( 8 bits )&lt;/th&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Decimal Place&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;128&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;64&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;32&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;16&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;8&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;4&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;2&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;1&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;2&lt;sup&gt;7&lt;/sup&gt;&lt;/td&gt;
&lt;td&gt;2&lt;sup&gt;6&lt;/sup&gt;&lt;/td&gt;
&lt;td&gt;2&lt;sup&gt;5&lt;/sup&gt;&lt;/td&gt;
&lt;td&gt;2&lt;sup&gt;4&lt;/sup&gt;&lt;/td&gt;
&lt;td&gt;2&lt;sup&gt;3&lt;/sup&gt;&lt;/td&gt;
&lt;td&gt;2&lt;sup&gt;2&lt;/sup&gt;&lt;/td&gt;
&lt;td&gt;2&lt;sup&gt;1&lt;/sup&gt;&lt;/td&gt;
&lt;td&gt;2&lt;sup&gt;0&lt;/sup&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;32&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;8&lt;/td&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;=&lt;/td&gt;
&lt;td&gt;46&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;br /&gt;
&lt;strong&gt;A decimal number 93 can be represent in binary form like bellow - &lt;/strong&gt;
&lt;br /&gt;
&lt;table class="table table-bordered"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;th colspan="11"&gt;1 Byte ( 8 bits )&lt;/th&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Decimal Place&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;128&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;64&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;32&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;16&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;8&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;4&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;2&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;1&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;2&lt;sup&gt;7&lt;/sup&gt;&lt;/td&gt;
&lt;td&gt;2&lt;sup&gt;6&lt;/sup&gt;&lt;/td&gt;
&lt;td&gt;2&lt;sup&gt;5&lt;/sup&gt;&lt;/td&gt;
&lt;td&gt;2&lt;sup&gt;4&lt;/sup&gt;&lt;/td&gt;
&lt;td&gt;2&lt;sup&gt;3&lt;/sup&gt;&lt;/td&gt;
&lt;td&gt;2&lt;sup&gt;2&lt;/sup&gt;&lt;/td&gt;
&lt;td&gt;2&lt;sup&gt;1&lt;/sup&gt;&lt;/td&gt;
&lt;td&gt;2&lt;sup&gt;0&lt;/sup&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;64&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;16&lt;/td&gt;
&lt;td&gt;8&lt;/td&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;=&lt;/td&gt;
&lt;td&gt;93&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;/div&gt;
&lt;strong&gt;Step 2:&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
Now perform Bitwise XOR Operation on them. The output will be 01110011.

After performing XOR operation on both the binary numbers, the bit set occurs at 2nd, 3rd, 4th, 7th and 8th digits respectively. So the 2nd, 3rd, 4th, 7th and 8th is at 2&lt;sup&gt;6&lt;/sup&gt;, 2&lt;sup&gt;5&lt;/sup&gt;, 2&lt;sup&gt;4&lt;/sup&gt;, 2&lt;sup&gt;1&lt;/sup&gt; and 2&lt;sup&gt;0&lt;/sup&gt; positions. See below that how to perform XOR bitwise operation on those two numbers.
&lt;br /&gt;
&lt;br /&gt;
&lt;table&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;Base 2&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;2&lt;sup&gt;7&lt;/sup&gt;&lt;/td&gt;
&lt;td&gt;2&lt;sup&gt;6&lt;/sup&gt;&lt;/td&gt;
&lt;td&gt;2&lt;sup&gt;5&lt;/sup&gt;&lt;/td&gt;
&lt;td&gt;2&lt;sup&gt;4&lt;/sup&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;2&lt;sup&gt;3&lt;/sup&gt;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;2&lt;sup&gt;2&lt;/sup&gt;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;2&lt;sup&gt;1&lt;/sup&gt;&lt;/td&gt;
&lt;td&gt;2&lt;sup&gt;0&lt;/sup&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;Binary 46&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;1&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;1&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;Binary 93&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;1&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;1&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;Result&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;1&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;1&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;1&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;1&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;1&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;br /&gt;
Now from the above manipulation, the bit set occurs at 2nd, 3rd, 4th, 7th and 8th digits respectively.&lt;br /&gt;
&lt;strong&gt;&lt;br /&gt;&lt;/strong&gt;
&lt;strong&gt;Step 3:&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
Now perform addition operation on these 2&lt;sup&gt;6&lt;/sup&gt;, 2&lt;sup&gt;5&lt;/sup&gt;, 2&lt;sup&gt;4&lt;/sup&gt;, 2&lt;sup&gt;1&lt;/sup&gt; and 2&lt;sup&gt;0&lt;/sup&gt;. You will get 2&lt;sup&gt;6&lt;/sup&gt; + 2&lt;sup&gt;5&lt;/sup&gt; + 2&lt;sup&gt;4&lt;/sup&gt; + 2&lt;sup&gt;1&lt;/sup&gt; + 2&lt;sup&gt;0&lt;/sup&gt; = 115.

Now you may be confused that how this answer 115 came. Don't get confused. Simply multiply the binary number quotient with base 2 and then perform addition on those numbers then you will get the answer.
&lt;br /&gt;
&lt;br /&gt;
&lt;table&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;(2&lt;sup&gt;7&lt;/sup&gt; x 0)&lt;/td&gt;
&lt;td&gt;+&lt;/td&gt;
&lt;td&gt;(2&lt;sup&gt;6&lt;/sup&gt; x 1)&lt;/td&gt;
&lt;td&gt;+&lt;/td&gt;
&lt;td&gt;(2&lt;sup&gt;5&lt;/sup&gt; x 1)&lt;/td&gt;
&lt;td&gt;+&lt;/td&gt;
&lt;td&gt;(2&lt;sup&gt;4&lt;/sup&gt; x 1)&lt;/td&gt;
&lt;td&gt;+&lt;/td&gt;
&lt;td&gt;(2&lt;sup&gt;3&lt;/sup&gt; x 0)&lt;/td&gt;
&lt;td&gt;+&lt;/td&gt;
&lt;td&gt;(2&lt;sup&gt;2&lt;/sup&gt; x 0)&lt;/td&gt;
&lt;td&gt;+&lt;/td&gt;
&lt;td&gt;(2&lt;sup&gt;1&lt;/sup&gt; x 1)&lt;/td&gt;
&lt;td&gt;+&lt;/td&gt;
&lt;td&gt;(2&lt;sup&gt;0&lt;/sup&gt; x 1)&lt;/td&gt;
&lt;td&gt;= 115&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;br /&gt;
Huh...These many steps...its really very frustrating..Don't panic..you don't have to worry about these many steps. Let's see the same in our php code. Its really very simple.
&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush:html"&gt;$x=46;

$y=93;

echo $x ^ $y; // output: 115&lt;/pre&gt;
&lt;pre class="brush:html"&gt;&lt;/pre&gt;
&lt;strong&gt;&lt;span style="font-size: large;"&gt;Bitwise NOT(~) :&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
The Bitwise NOT operator perform on two values and returns true when set bit of one expression is not set in another expression.&lt;br /&gt;
&lt;strong&gt;&lt;br /&gt;&lt;/strong&gt;
&lt;strong&gt;Demo:&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
Let's take two numbers 46 and 93 respectively. Now perform binary conversion for these two numbers.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Step 1:&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
Converting decimal numbers 46 and 93 into their binary form.&amp;nbsp;
&lt;br /&gt;
&lt;br /&gt;
The binary representation of 46 - 00101110&lt;br /&gt;
&lt;br /&gt;
The binary representation of 93 - 01011101&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;A decimal number 46 can be represent in binary form like bellow - &lt;/strong&gt;
&lt;br /&gt;
&lt;table&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;th colspan="11"&gt;1 Byte ( 8 bits )&lt;/th&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Decimal Place&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;128&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;64&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;32&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;16&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;8&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;4&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;2&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;1&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;2&lt;sup&gt;7&lt;/sup&gt;&lt;/td&gt;
&lt;td&gt;2&lt;sup&gt;6&lt;/sup&gt;&lt;/td&gt;
&lt;td&gt;2&lt;sup&gt;5&lt;/sup&gt;&lt;/td&gt;
&lt;td&gt;2&lt;sup&gt;4&lt;/sup&gt;&lt;/td&gt;
&lt;td&gt;2&lt;sup&gt;3&lt;/sup&gt;&lt;/td&gt;
&lt;td&gt;2&lt;sup&gt;2&lt;/sup&gt;&lt;/td&gt;
&lt;td&gt;2&lt;sup&gt;1&lt;/sup&gt;&lt;/td&gt;
&lt;td&gt;2&lt;sup&gt;0&lt;/sup&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;32&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;8&lt;/td&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;=&lt;/td&gt;
&lt;td&gt;46&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;br /&gt;
&lt;strong&gt;A decimal number 93 can be represent in binary form like bellow - &lt;/strong&gt;
&lt;br /&gt;
&lt;table class="table table-bordered"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;th colspan="11"&gt;1 Byte ( 8 bits )&lt;/th&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Decimal Place&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;128&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;64&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;32&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;16&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;8&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;4&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;2&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;1&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;2&lt;sup&gt;7&lt;/sup&gt;&lt;/td&gt;
&lt;td&gt;2&lt;sup&gt;6&lt;/sup&gt;&lt;/td&gt;
&lt;td&gt;2&lt;sup&gt;5&lt;/sup&gt;&lt;/td&gt;
&lt;td&gt;2&lt;sup&gt;4&lt;/sup&gt;&lt;/td&gt;
&lt;td&gt;2&lt;sup&gt;3&lt;/sup&gt;&lt;/td&gt;
&lt;td&gt;2&lt;sup&gt;2&lt;/sup&gt;&lt;/td&gt;
&lt;td&gt;2&lt;sup&gt;1&lt;/sup&gt;&lt;/td&gt;
&lt;td&gt;2&lt;sup&gt;0&lt;/sup&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;64&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;16&lt;/td&gt;
&lt;td&gt;8&lt;/td&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;=&lt;/td&gt;
&lt;td&gt;93&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;/div&gt;
&lt;strong&gt;Step 2:&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
Now perform Bitwise NOT Operation on them. The output will be 00100010.

Now from the above manipulation, the bit set occurs at 3rd, and 7th digits respectively.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Step 3:&lt;/strong&gt;
&lt;br /&gt;
&lt;strong&gt;&lt;br /&gt;&lt;/strong&gt;
&lt;br /&gt;
&lt;div&gt;
Now perform addition operation on these, You will get 2&lt;sup&gt;5&lt;/sup&gt; + 2&lt;sup&gt;1&lt;/sup&gt; = 34.&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Now you may be confused that how this answer 34 came. Don't get confused. Simply multiply the binary number quotient with base 2 and then perform addition on those numbers then you will get the answer.&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;table&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;Base 2&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;2&lt;sup&gt;7&lt;/sup&gt;&lt;/td&gt;
&lt;td&gt;2&lt;sup&gt;6&lt;/sup&gt;&lt;/td&gt;
&lt;td&gt;2&lt;sup&gt;5&lt;/sup&gt;&lt;/td&gt;
&lt;td&gt;2&lt;sup&gt;4&lt;/sup&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;2&lt;sup&gt;3&lt;/sup&gt;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;2&lt;sup&gt;2&lt;/sup&gt;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;2&lt;sup&gt;1&lt;/sup&gt;&lt;/td&gt;
&lt;td&gt;2&lt;sup&gt;0&lt;/sup&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;Binary 46&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;1&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;1&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;Binary 93&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;1&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;1&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;Result&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&amp;nbsp;
&lt;br /&gt;
&lt;table&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;(2&lt;sup&gt;7&lt;/sup&gt; x 0)&lt;/td&gt;
&lt;td&gt;+&lt;/td&gt;
&lt;td&gt;(2&lt;sup&gt;6&lt;/sup&gt; x 0)&lt;/td&gt;
&lt;td&gt;+&lt;/td&gt;
&lt;td&gt;(2&lt;sup&gt;5&lt;/sup&gt; x 1)&lt;/td&gt;
&lt;td&gt;+&lt;/td&gt;
&lt;td&gt;(2&lt;sup&gt;4&lt;/sup&gt; x 0)&lt;/td&gt;
&lt;td&gt;+&lt;/td&gt;
&lt;td&gt;(2&lt;sup&gt;3&lt;/sup&gt; x 0)&lt;/td&gt;
&lt;td&gt;+&lt;/td&gt;
&lt;td&gt;(2&lt;sup&gt;2&lt;/sup&gt; x 0)&lt;/td&gt;
&lt;td&gt;+&lt;/td&gt;
&lt;td&gt;(2&lt;sup&gt;1&lt;/sup&gt; x 1)&lt;/td&gt;
&lt;td&gt;+&lt;/td&gt;
&lt;td&gt;(2&lt;sup&gt;0&lt;/sup&gt; x 0)&lt;/td&gt;
&lt;td&gt;= 34&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;br /&gt;
Huh...These many steps...its really very frustrating..Don't panic..you don't have to worry about these many steps. Let's see the same in our php code. Its really very simple.
&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush:html"&gt;$x=46;&lt;/pre&gt;
&lt;pre class="brush:html"&gt;$y=93;&lt;/pre&gt;
&lt;pre class="brush:html"&gt;echo $x &amp;amp;^ $y; // output: 34
&lt;/pre&gt;
&lt;pre class="brush:html"&gt;&lt;/pre&gt;
&lt;strong&gt;&lt;span style="font-size: large;"&gt;Left and Right Shift:&lt;/span&gt;&lt;/strong&gt;

&lt;br /&gt;
&lt;strong&gt;&lt;br /&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;
If a and b are two numbers, BIT SHIFTING shifts a bits b number of steps. each step refers to multiply by two if it is BIT SHIFT LEFT. If it is BIT SHIFT RIGHT, then each step refers to division by two.&lt;strong&gt;Demo:&lt;/strong&gt;

&lt;span style="font-family: Consolas, Monaco, monospace; font-size: 12px; line-height: 18px;"&gt;$x=8;&lt;/span&gt;
&lt;br /&gt;
&lt;pre class="brush:html"&gt;$y=3;
echo $x &amp;gt;&amp;gt; $y; // output: 1
echo $x &amp;lt;&amp;lt; $y; // output: 64&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/phphunger/xvuf/~4/1lt0U8XcKUo" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/phphunger/xvuf/~3/1lt0U8XcKUo/understanding-operators-in-php-part-3.html</link><author>noreply@blogger.com (Samiullah Muhammed)</author><thr:total>0</thr:total><feedburner:origLink>http://www.phphunger.com/2013/02/understanding-operators-in-php-part-3.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7633149608386800006.post-2262695170026803452</guid><pubDate>Thu, 21 Feb 2013 09:45:00 +0000</pubDate><atom:updated>2013-04-01T09:36:42.819-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">PHP Developer Journey - Tutorial</category><title>Understanding Operators in PHP - Part 2</title><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;br /&gt;
Hi all, after long time i am back with my phphunger's PHP Developer Journey tutorials. As i was busy with my some new assignments so couldn't able to post the articles. Now i am back and i will continue writing the articles.&lt;br /&gt;
&lt;br /&gt;
As i was discussing about the Operators in PHP let's continue the PHP operators. If you want to start off with PHP Operators then please follow this &lt;a href="http://www.phphunger.com/2012/09/understanding-operators-in-php-part-1.html#.USXMiR2dcbs" rel="nofollow" target="_blank"&gt;&lt;b&gt;&lt;span style="color: #0b5394;"&gt;Understanding Operators in PHP - Part 1&lt;/span&gt;&lt;/b&gt;&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style="font-size: large;"&gt;String Operators:&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
PHP provides you 2 kinds of string operators. These 2 string operators are for&amp;nbsp;concatenating&amp;nbsp;2 or more string operands or string arguments.&lt;br /&gt;
&lt;br /&gt;
The symbol for&amp;nbsp;concatenation&amp;nbsp;operation is the dot symbol(.). Now let's see the 2 string operators.&lt;br /&gt;
&lt;br /&gt;
The first string operator is a simple dot ('.') symbol which returns the concatenation of its right and left arguments.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush:html"&gt;$a = "sami";
$b = "ullah";
$c = $a.$b;
echo $c; //now $c contains "samiullah"
&lt;/pre&gt;
&lt;br /&gt;
The second is the concatenating assignment operator ('.='), which appends the argument on the right side to the argument on the left side.&lt;br /&gt;
Example:&lt;br /&gt;
&lt;pre class="brush:html"&gt;$a = "sami";
$a .= "ullah"; // now $a contains "samiullah"
&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style="font-size: large;"&gt;Logical Operators:&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Logical operators first convert their operands to boolean values and then perform the respective comparison.&lt;br /&gt;
&lt;br /&gt;
There are four logical operators in PHP, of which three are binary.&lt;br /&gt;
&lt;br /&gt;
The four standard logical operators &lt;b&gt;and(&amp;amp;&amp;amp;), or(||), not(!) and xor(xor)&lt;/b&gt; are supported by PHP.&lt;br /&gt;
&lt;br /&gt;
Among the four logical operators there is &lt;b&gt;only unary operator&lt;/b&gt; and that is &lt;b&gt;Logical NOT(!)&lt;/b&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Note:&lt;/b&gt; All logical operators only work with Boolean values. Therefore, PHP will first convert any other value to a Boolean and then perform the operation.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Example: (Logical AND (&amp;amp;&amp;amp;))&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush:html"&gt;$username = 'admin';

$password = 'admin123';

if($username == 'admin' &amp;amp;&amp;amp; $password == 'admin123'){

echo 'Login Success...';

}else{

echo 'Login Failed...';

}&lt;/pre&gt;
&lt;br /&gt;
&lt;b&gt;&lt;u&gt;Logical AND Demo Explanation:&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div style="text-align: justify;"&gt;
In the above program i have created 2 variables called &lt;b&gt;&lt;i&gt;$username&lt;/i&gt;&lt;/b&gt; and &lt;b&gt;&lt;i&gt;$password&lt;/i&gt;&lt;/b&gt; with some values assigned to them. Here the if condition checks whether both the values are true or not. If both the values are true means the if condition is true then the success message will be printed.&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
Remember the truth table for the AND Operation. If both the values are TRUE then the output will be TRUE else FALSE. See the below Truth Table for better understanding.&lt;/div&gt;
&lt;table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-I9uLQjF8-bY/USXLabo7u6I/AAAAAAAAAO8/sseqZ_tgS7g/s1600/AND-Truth-Table+copy.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="244" src="http://4.bp.blogspot.com/-I9uLQjF8-bY/USXLabo7u6I/AAAAAAAAAO8/sseqZ_tgS7g/s320/AND-Truth-Table+copy.jpg" width="320" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;AND Truth Table&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;
&lt;b&gt;Example: (Logical OR (||))&lt;/b&gt;&lt;br /&gt;
&lt;pre class="brush:html"&gt;$name = 'sami';

$age = 28;

if($name == 'sami' &amp;amp;&amp;amp; ($age == 28 || $age == 30)){

 echo 'Login Success...';

}else{

 echo 'Login Failed...';

}
&lt;/pre&gt;
&lt;br /&gt;
&lt;b&gt;&lt;u&gt;Logical OR Demo Explanation:&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
In the above program i have created 2 variables called &lt;b&gt;&lt;u&gt;$name&lt;/u&gt;&lt;/b&gt; and &lt;b&gt;&lt;u&gt;$age&lt;/u&gt;&lt;/b&gt; with some values assigned to them. Here the if condition checks whether any one of the value is true or not. If any one of the value is true means the if condition is true then the success message will be printed.&lt;br /&gt;
&lt;br /&gt;
Remember the truth table for the OR Operation. If any one of the value is true then the output will be TRUE else FALSE. See the below Truth Table for better understanding.&lt;br /&gt;
&lt;table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-x5lTmzro8qo/USXKu_sFRWI/AAAAAAAAAO0/SeKMVPVHGr8/s1600/OR-Truth-Table.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="244" src="http://4.bp.blogspot.com/-x5lTmzro8qo/USXKu_sFRWI/AAAAAAAAAO0/SeKMVPVHGr8/s320/OR-Truth-Table.jpg" width="320" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;OR Truth Table&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Example: (Logical NOT (!))&lt;/b&gt;&lt;br /&gt;
&lt;pre class="brush:html"&gt;$con = mysql_connect('localhost','root','');

if(!$con){

 die('Could not connect to DB'.mysql_error());

}else{

 echo 'MySQL DB Connection Success';

}
&lt;/pre&gt;
&lt;pre class="brush:html"&gt;&lt;/pre&gt;
&lt;u&gt;&lt;b&gt;Logical NOT (!) Demo Explanation:&lt;/b&gt;&lt;/u&gt;&lt;br /&gt;
&lt;u&gt;&lt;br /&gt;&lt;/u&gt;&lt;/div&gt;
&lt;span style="font-family: inherit;"&gt;In the above program i have created a variable called $con with some value assigned to it. Don't be scared about the value which i assigned to the variable $con. This thing will be discussed in future lessons. So till then stick to it.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: inherit;"&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style="font-family: inherit;"&gt;Here the if condition checks if the $con variable is not set properly then shows some error message else shows success message.

Remember the truth table for the NOT Operation. If value is TRUE then the output will be FALSE and if value is FALSE then the output will be TRUE. See the below Truth Table for better understanding.&lt;/span&gt;&lt;br /&gt;
&lt;table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-_mVfm077BGI/USXhFDjfIiI/AAAAAAAAAPQ/sKyYO20fbcI/s1600/nottt.JPG" imageanchor="1" style="margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/-_mVfm077BGI/USXhFDjfIiI/AAAAAAAAAPQ/sKyYO20fbcI/s1600/nottt.JPG" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;NOT Truth Table&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
Hope you have some what good idea of some of the php operators. Let's practice and make yours hands dirty. More operators lessons will continue in the next article. Till then happy coding...&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/phphunger/xvuf/~4/4JuQGguJQpA" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/phphunger/xvuf/~3/4JuQGguJQpA/understanding-operators-in-php-part-2.html</link><author>noreply@blogger.com (Samiullah Muhammed)</author><media:thumbnail url="http://4.bp.blogspot.com/-I9uLQjF8-bY/USXLabo7u6I/AAAAAAAAAO8/sseqZ_tgS7g/s72-c/AND-Truth-Table+copy.jpg" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://www.phphunger.com/2013/02/understanding-operators-in-php-part-2.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7633149608386800006.post-7134159660395299689</guid><pubDate>Thu, 07 Feb 2013 05:48:00 +0000</pubDate><atom:updated>2013-02-22T21:30:17.486-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Others</category><title>How to know the Company is Registered or not in India?</title><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;br /&gt;
Here are the 3 Steps to Choose the Experience of any Consultancy or Company. Let's follow.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style="font-size: large;"&gt;Step 1: How to Find Company PAN and TAN Numbers to Provide Form16&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;Step 1: Open &lt;b&gt;&lt;span style="color: #134f5c;"&gt;&lt;a href="http://www.incometaxindiaefiling.gov.in/" target="_blank"&gt;www.incometaxindiaefiling.gov.in&lt;/a&gt;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;
&amp;nbsp;Step 2: Go to Left hand side, Services-&amp;gt;Click On &amp;nbsp;Know Your TAN&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;Step 3: Select the Category of Deductor as &amp;nbsp;Company&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;Step 4: Select the State as &amp;nbsp;Karnataka( or Maharashtra...Depending on State)&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;Step 5: Put the tick mark for &amp;nbsp;Name&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;Step 6: Enter the &amp;nbsp;Company Name( Minimum 4 Characters)(Example: XYZ Tech)&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;Step 7: Enter the Captcha Code&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;Step 8: Click on Submit,you get the company details&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;Step 9: A Valid Company should have &amp;nbsp;PAN&lt;br /&gt;
&lt;br /&gt;
&lt;ul style="text-align: left;"&gt;
&lt;li&gt;A Valid Company should have TAN&lt;/li&gt;
&lt;li&gt;Comapny Address Should Match with Current Address&lt;/li&gt;
&lt;li&gt;A Valid Company Status should be Active&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
&amp;nbsp;Step 10: If above Steps Satisfies then only company can generate&amp;nbsp;Genuine&amp;nbsp;Taxable &lt;b&gt;Form 16&lt;/b&gt;&lt;br /&gt;
&amp;nbsp;If above steps are not satisfies then generating &lt;b&gt;Form 16&lt;/b&gt; is not possible&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style="font-size: large;"&gt;Step 2: How to Find the Registered Company&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;Step 1: Open &lt;a href="http://www.mca.gov.in/" target="_blank"&gt;&lt;b&gt;&lt;span style="color: #134f5c;"&gt;www.mca.gov.in&lt;/span&gt;&lt;/b&gt;&lt;/a&gt;(Close all small Pop Ups)&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;Step 2: Click on MCA21(It will Take you to &lt;a href="http://www.mca.gov.in/mca21/" target="_blank"&gt;&lt;b&gt;&lt;span style="color: #134f5c;"&gt;www.mca.gov.in/mca21/&lt;/span&gt;&lt;/b&gt;&lt;/a&gt;)&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;Step 3: Left hand side you can see quick links.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; click on Check Company or LLP Name&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;Step 4: Enter Your Company Name at *Company or LLP Name Edit Box&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; (Example: XYZ Infotech)and Click on Search Button&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;Step 5: If it is Registered Company you will get all details including company registered date&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; If it is &amp;nbsp;not Registered &amp;nbsp;Company you will get pop up message with "No match found"&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style="font-size: large;"&gt;Step 3: How to Find Age of the Company or Domain&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;Step 1: Open &lt;b&gt;&lt;a href="http://www.who.is/" target="_blank"&gt;&lt;span style="color: #134f5c;"&gt;www.who.is&lt;/span&gt;&lt;/a&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;
&amp;nbsp;Step 2: Enter the Company URL(Example:www.xyztech.com) in the search Bar&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;Step 3: Click on Who.is Search button and check out for Registred on Date&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/phphunger/xvuf/~4/9vMxA9Vvmvw" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/phphunger/xvuf/~3/9vMxA9Vvmvw/how-to-know-company-is-registered-or.html</link><author>noreply@blogger.com (Samiullah Muhammed)</author><thr:total>0</thr:total><feedburner:origLink>http://www.phphunger.com/2013/02/how-to-know-company-is-registered-or.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7633149608386800006.post-2626797770031773611</guid><pubDate>Tue, 18 Sep 2012 08:17:00 +0000</pubDate><atom:updated>2013-04-01T09:42:55.109-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">PHP Developer Journey - Tutorial</category><title>Understanding Operators in PHP - Part 1</title><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;div style="text-align: justify;"&gt;
Can you imagine a programming or scripting language without operators? Just imagine. No way. You can't code without the operators in any programming or scripting langauge and PHP is not an exception. If &lt;b&gt;&lt;a href="http://www.phphunger.com/2012/08/understanding-php-variables.html" target="_blank"&gt;&lt;span style="color: #0b5394;"&gt;variables and values&lt;/span&gt;&lt;/a&gt;&lt;/b&gt; are the heart of a programming&amp;nbsp;language&amp;nbsp;then &lt;b&gt;operators&lt;/b&gt; are the soul of programming language.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://2.bp.blogspot.com/-nnFs7cS8240/UFgtrt75M_I/AAAAAAAAAN8/aRsLb17O1IM/s1600/OPERATORS-1.jpg" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="214" width="320" src="http://2.bp.blogspot.com/-nnFs7cS8240/UFgtrt75M_I/AAAAAAAAAN8/aRsLb17O1IM/s320/OPERATORS-1.jpg" alt="php operators"/&gt;&lt;/a&gt;&lt;/div&gt;


By knowingly or unknowingly we have already used an operator called Assignment operator(=) in our previous article. You can also check &lt;b&gt;&lt;a href="http://www.phphunger.com/2012/08/understanding-php-variables.html" target="_blank"&gt;&lt;span style="color: #0b5394;"&gt;here&lt;/span&gt;&lt;/a&gt;&lt;/b&gt;. So What's the use of Variables, Constants and Datatypes if you can't manipulate them with variety of ways. So the variety of ways is through Operators. PHP supports different types of Operators. Let's see the different operators. Before this lets first see what's an operator?&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style="color: #073763; font-size: large;"&gt;What is an Operator?&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
An operator is a symbol like +,-,*,/ etc that takes one or more values and gives another value.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;u&gt;For example:&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush:html"&gt;
$a = 1; //= is an operator&lt;br /&gt;
$b = 2;&lt;br /&gt;
echo $a + $b; // + is an operator&lt;br /&gt;
echo $a - $b; // - is an operator&lt;br /&gt;
echo $a * $b; // * is an operator&lt;br /&gt;
&lt;/pre&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style="color: #073763; font-size: large;"&gt;Different types of Operators in PHP&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
According to php.net, there are different kinds of operators available. See the different kinds of operators available in PHP.&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;Assignment Operators&lt;/li&gt;
&lt;li&gt;Arithmetic Operators&lt;/li&gt;
&lt;li&gt;Array Operators&lt;/li&gt;
&lt;li&gt;String Operators&lt;/li&gt;
&lt;li&gt;Bitwise Operators&lt;/li&gt;
&lt;li&gt;Logical Operators&lt;/li&gt;
&lt;li&gt;Comparison Operators&lt;/li&gt;
&lt;li&gt;Error Control Operators&lt;/li&gt;
&lt;li&gt;Execution Operators&lt;/li&gt;
&lt;li&gt;Incrementing/Decrementing Operators&lt;/li&gt;
&lt;li&gt;Type Operators&lt;/li&gt;
&lt;li&gt;Operator Precedence&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;span style="color: #073763; font-size: large;"&gt;&lt;u&gt;Assignment Operators:&lt;/u&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
The basic assignment operator is to assign a value to a variable. As we did perviously in our &lt;a href="http://www.phphunger.com/2012/08/understanding-php-variables.html" target="_blank"&gt;&lt;b&gt;&lt;span style="color: #0b5394;"&gt;understanding variables&lt;/span&gt;&lt;/b&gt;&lt;/a&gt; article.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Let's see how to assign a value to a variable.&lt;/div&gt;
&lt;pre class="brush:html"&gt;
$a1 = 10;
$a2 = "Hello world";
$a3 = true;
&lt;/pre&gt;
From the above statements you can understand easily that $a1 is a variable holds a value 10, $a2 is a variable holds a value "Hello world", $a3 is a variable holds a value true. Like wise you can assign different values to different variables.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;span style="color: #073763;"&gt;Note :&lt;/span&gt;&lt;/b&gt; In mathematical jargon, the meaning of "=" is diferent and in programming jargon, the meaning of "=" is different. In PHP programming jargon, "=" is a known as "is assigned to" . To represent "equal to" in PHP programming use instead "=="(two equals signs).&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style="color: #073763;"&gt;What is the meaning of "variables are assigned by value" or "variables are assigned by reference"?&lt;/span&gt;&lt;/b&gt; I'm little bit confused.!!&lt;br /&gt;
&lt;br /&gt;
By default, variables are assigned by value. Means, every variable has to be assigned some value. Confused, let's see the example.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush:html"&gt;
$a = $b;
&lt;/pre&gt;
From the above statement, $b is assigned to $a. Means, if you change $b after the assignment has taken place, then $a remains the same. This is not what actually we want. If we change $b then $a should also be changed. So need to invent something for this scenario.&lt;br /&gt;
&lt;br /&gt;
So to overcome this situation, PHP comes with a concept called &lt;b&gt;"reference variables".&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush:html"&gt;
$a = &amp;amp;$b;
&lt;/pre&gt;
Reference is denoted with ampersand symbol(&amp;amp;). Now any change to $b will also be reflected in $a.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Example:&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;
&lt;pre class="brush:html"&gt;
$a = 1;
$b = 2;
$a = $b;
echo $a; // output: 2
$b = 3;
echo $a; // output: 2
$a = &amp;amp;$b;
echo $a; // output: 3
&lt;/pre&gt;
&lt;div&gt;
&lt;b&gt;&lt;span style="color: #073763; font-size: large;"&gt;Arithmetic&amp;nbsp;Operators:&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Remember those school days in which you were supposed to do simple mathematical&amp;nbsp;calculations using&amp;nbsp;arithmetic&amp;nbsp;operators. The same operators now we are going to use. So lets understand different arithematic operators:&amp;nbsp;Namely &lt;b&gt;Addition(+), Subtraction(-), Multiplication(*), Division(/) and Modulus(%)&lt;/b&gt;.&amp;nbsp;Apart from addition, subtraction, multiplication and division, the modulus operator is bit different from others. Since it returns the remainder of the two operands. Confused, lets see&amp;nbsp;a small example on&amp;nbsp;arithmetic&amp;nbsp;operators.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Example:&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush:html"&gt;
$a1 = 10; // variable a1 holds value 10
$a2 = 5; // variable a2 holds value 5
/* Addition Operation with (+) */
echo $a1 + $a2; // output will be 15&lt;br /&gt;
/* Subtraction Operation with (-) */
echo $a1 - $a2; // output will be 5&lt;br /&gt;
/* Multiplication Operation with (*) */
echo $a1 * $a2; // output will be 50&lt;br /&gt;
/* Division Operation with (/) */
echo $a1 / $a2; // output will be 2&lt;br /&gt;
/* Modulus Operation with (%) */
echo $a1 % $a2; // output will be 0
&lt;/pre&gt;
Apart from these operators, PHP borrows four special operators from C language. These operators are:&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;1. Prefix incrementing operator (++$variable_name) :&lt;/b&gt; The prefix incrementing operator first increments the value of the variable and then returns its new value.&lt;br /&gt;
&lt;b&gt;2. Postfix incrementing operator ($variable_name++):&lt;/b&gt; The postfix incrementing operator first returns the values of the varible and then increments its value.&lt;br /&gt;
&lt;b&gt;3. Prefix decremeting operator (--$variable_name) :&lt;/b&gt; The prefix decrementing operator first decrements the value of the variable and then returns its new value.&lt;br /&gt;
&lt;b&gt;4. Postfix decrementing operator ($variable_name--) :&lt;/b&gt; The postfix decrement operator first returns the value of the variable and then decrements its value.&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;b&gt;&lt;span style="color: #073763; font-size: large;"&gt;Array Operators:&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
The + operator performs Union operation when working with the arrays. The Union is&amp;nbsp;same as the&amp;nbsp;mathematics&amp;nbsp;union operation. The union operation returns matched key values&amp;nbsp;from both the ends. Like while performing union operation it checks the&amp;nbsp;matched&amp;nbsp;key values only.&amp;nbsp;If matched keys found at both ends then it returns the right handed side values&amp;nbsp;denies the left handed values plus the extra values which are not found in the right handed side array.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Example:&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush:html"&gt;
/* Array Operators */
$a = array('1'=&amp;gt;'a','2'=&amp;gt;'b');&lt;br /&gt;
$b = array('1'=&amp;gt;'c,'2'=&amp;gt;'d','3'=&amp;gt;'e');&lt;br /&gt;
$c = array('1'=&amp;gt;'f','2'=&amp;gt;'g','3'=&amp;gt;'h','4'=&amp;gt;'i');&lt;br /&gt;
$d = $a + $b + $c;
echo "Union of \$a and \$b and \$c:";&lt;br /&gt;
var_dump($d);
&lt;/pre&gt;
&lt;b&gt;Lets see different array operators:&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Union(+) :&lt;/b&gt;&amp;nbsp;Union of $var1 and $var2.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Equality(==) :&lt;/b&gt;&amp;nbsp;TRUE if $var1 and $var2 have the same key/value pairs.&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Identity(===) :&lt;/b&gt;&amp;nbsp;TRUE if $var1 and $var2 have the same key/value pairs in the same order and of the same types.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Inequality(!=) :&lt;/b&gt;&amp;nbsp;TRUE if $var1 is not equal to $var2.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Inequality(&amp;lt;&amp;gt;) :&lt;/b&gt;&amp;nbsp;TRUE if $var1 is not equal to $var2.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Non-identity(!==) :&lt;/b&gt;&amp;nbsp;TRUE if $var1 is not identical to $var2.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Example: (With Equality operator ==)&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush:html"&gt;
$one = array("apple","banana");&lt;br /&gt;
$two = array(1 =&amp;gt; "banana", "0" =&amp;gt; "apple");&lt;br /&gt;
var_dump($one == $two);&lt;br /&gt;
&lt;br /&gt;
&lt;/pre&gt;
The equality operator compares two variables and returns TRUE if both variables have the same key/value pairs otherwise returns FALSE. From the above code, both variables have same key/value pairs so returns a&amp;nbsp;Boolean&amp;nbsp;value TRUE.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Example: (With&lt;/b&gt;&amp;nbsp;&lt;b&gt;Identity&lt;/b&gt;&amp;nbsp;&lt;b&gt;operator ===)&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush:html"&gt;
$one = array("apple","banana");&lt;br /&gt;
$two = array(1 =&amp;gt; "banana", "0" =&amp;gt; "apple");&lt;br /&gt;
var_dump($one === $two);
&lt;/pre&gt;
The identity operator compares two variables and returns TRUE if both variables have the same key/value pairs in the same order and of the same types otherwise returns FALSE. From the above code, both variables have same key/value pairs but not in order so returns a&amp;nbsp;Boolean&amp;nbsp;value FALSE.
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Example: (With&lt;/b&gt;&amp;nbsp;
&lt;b&gt;Inequality&lt;/b&gt;&amp;nbsp;&lt;b&gt;operator !=)&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush:html"&gt;
$one = array("apple","banana");&lt;br /&gt;
$two = array(1 =&amp;gt; "banana", "0" =&amp;gt; "apple");&lt;br /&gt;
var_dump($one != $two);
&lt;/pre&gt;
The inequality operator compares two variables and returns TRUE if one variable is not equal to another variable otherwise returns FALSE. From the above code, variable $one is equal to variable $two so returns a Boolean value FALSE.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Example: (With&amp;nbsp;&lt;/b&gt;&lt;b&gt;Inequality&lt;/b&gt;&amp;nbsp;&lt;b&gt;operator &amp;lt;&amp;gt;)&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush:html"&gt;
$one = array("apple","banana");&lt;br /&gt;
$two = array(1 =&amp;gt; "banana", "0" =&amp;gt; "apple");&lt;br /&gt;
var_dump($one &amp;lt;&amp;gt; $two);
&lt;/pre&gt;
The inequality operator compares two variables and returns TRUE if one variable is not equal to another variable otherwise returns FALSE. From the above code, variable $one is equal to variable $two so returns a Boolean value FALSE.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Example: (With&amp;nbsp;&lt;/b&gt;
&lt;b&gt;Non-identity&lt;/b&gt;&amp;nbsp;&lt;b&gt;operator !==)&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush:html"&gt;
$one = array("apple","banana");&lt;br /&gt;
$two = array(1 =&amp;gt; "banana", "0" =&amp;gt; "apple");&lt;br /&gt;
var_dump($one !== $two);
&lt;/pre&gt;
The non-identity operator compares two variables and returns TRUE if one variable is not identical to another variable otherwise returns FALSE. From the above code, variable $one is not identical to variable &amp;nbsp;$two so returns a Boolean value TRUE.&lt;br /&gt;
&lt;br /&gt;
Now its your turn to make your hands dirty by practicing these different operators. As the topic is some what lengthy so i will cove more operators in the next article. Till then keep practicing.&lt;br /&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/phphunger/xvuf/~4/C425IQTw7TQ" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/phphunger/xvuf/~3/C425IQTw7TQ/understanding-operators-in-php-part-1.html</link><author>noreply@blogger.com (Samiullah Muhammed)</author><media:thumbnail url="http://2.bp.blogspot.com/-nnFs7cS8240/UFgtrt75M_I/AAAAAAAAAN8/aRsLb17O1IM/s72-c/OPERATORS-1.jpg" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://www.phphunger.com/2012/09/understanding-operators-in-php-part-1.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7633149608386800006.post-3012994962706209392</guid><pubDate>Mon, 13 Aug 2012 08:42:00 +0000</pubDate><atom:updated>2013-04-01T09:47:16.080-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">PHP Developer Journey - Tutorial</category><title>Understanding PHP Variables</title><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;br /&gt;
I hope you got some idea of how the php code will be strucured and how to show the content with php. If you still have doubts or not yet read then first please read it. You can find here php's structure and syntax.&lt;br /&gt;
&lt;br /&gt;
Now let's move on to the next concept called "Variables". Can you imagine a language without variables? Just imagine. No way!! If a programming language doesn't provide data manipulation then that langauge will be in a great darkness. No one can use the language. So as programmer you have to choose different data types with respect to your application requirement.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style="color: #073763; font-size: large;"&gt;What is a Variable?&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
A variable is a representation of a particular value, such as name of a person or price of something etc.&lt;br /&gt;
Its your sole responsibilty as a programmer that when dealing with data, its important for you to deal what kind of data you are dealing with. For example, for a Hospital management system if you ask a patient how many times you have been visited the hospital and in reply if he says 1.5 times then its purely illogical. Means from this statement we can say a patient can't visit 1.5 times. It may be 1 time or 2 times etc. Like wise if you ask the patient about his name and in reply if he says 12345 then its also illogical.&lt;br /&gt;
&lt;br /&gt;
Like many other languages support different data types, PHP is not an exception it also supports different data types. Let's see.&lt;br /&gt;
&lt;br /&gt;
&lt;span style="color: #073763; font-size: large;"&gt;&lt;b&gt;How to create a Variable?&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
•&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;To create a variable first of all look for a good name. Means if your application needs to store some name then name the variable as username. Means give some meaningful name which can be easy for you to remember.&lt;br /&gt;
•&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Put the dollar($) sign in front of the username. Like this $username.&lt;br /&gt;
•&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;If you want to store some value or assign something to it then do like this. $username = "phphunger". You can use the assignment operator called = to assign some value to a variable.&lt;br /&gt;
That's it you have created the variable. Hurrah...&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style="color: #073763; font-size: large;"&gt;Rules for creating the variables&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Rule 1: All variables must begin with a $ symbol and followed by a good name.&lt;br /&gt;
Eg: $username, $price, $gender&lt;br /&gt;
&lt;br /&gt;
Rule 2: A variable can not start with a numeric character.&lt;br /&gt;
Eg: $1, $2username, $321price&lt;br /&gt;
&lt;br /&gt;
Rule 3: A varible can contain numbers and underscore character(_).&lt;br /&gt;
Eg: $username123, $oneby2, $value_1&lt;br /&gt;
&lt;br /&gt;
Rule 4: A variable can start with underscore character (_).&lt;br /&gt;
Eg: $_abc&lt;br /&gt;
&lt;br /&gt;
Rule 5: A variable is case-sensitive.&lt;br /&gt;
Eg: $username and $USERNAME are two different variables.&lt;br /&gt;
&lt;br /&gt;
&lt;span style="color: #073763; font-size: large;"&gt;&lt;b&gt;What are the different types of variables?&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
PHP supports mainly 2 types of varibles. Under this there are so many types available. Let's see.&lt;br /&gt;
1.&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Scalar&lt;br /&gt;
2.&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Array&lt;br /&gt;
&lt;br /&gt;
The scalar type variables holds only one value at a time and arrays holds list of values or another array.&lt;br /&gt;
&lt;br /&gt;
Let's see different scalar variable types.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Numeric Values:&lt;/b&gt; Integer and Floating values&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Integer Values:&lt;/b&gt; Whole numbers (numbers without decimals). Examples are 1, 345, and 9922786. You can also use octal and hexadecimal notation: The octal 0123 is decimal 83 and the hexadecimal 0x12 is decimal 18.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Floating point values:&lt;/b&gt; Numbers with decimals. Examples are 1.5, 87.3446, and 0.88889992.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;String Values:&lt;/b&gt; Single quote, Double quote and Heredoc values&lt;br /&gt;
&lt;br /&gt;
Text or numeric information, specified within double quotes (" ") or single quotes (' ').&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;&amp;lt;&amp;lt; heredoc tag is followed by an arbitrary string of text (which we’ll call the marker) on a single line. The interpreter will parse the contents of the file as a string until the marker is found, on its own, at the beginning of a line, followed by a semicolon. Heredoc strings can come in handy when you want to embed large amounts of text in your scripts—although you can sometimes achieve a similar goal by simply switching in and out of PHP mode.&lt;br /&gt;
&lt;br /&gt;
Eg:&lt;br /&gt;
&amp;lt;&amp;lt;My text goes here.&lt;br /&gt;
More text can go on another line.&lt;br /&gt;
You can even use escape sequences: \t&lt;br /&gt;
ENDOFTEXT;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Boolean Values:&lt;/b&gt; TRUE or FALSE&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Array values:&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Arrays are an aggregate value—that is, they represent a collection of other values. In PHP, arrays can contain an arbitrary number of elements of heterogeneous type (including other arrays). Each element is assigned a key—another scalar value used to identify the element within the array. The arrays will be covered later in the future articles. Be patient.&lt;br /&gt;
&lt;br /&gt;
Apart from these variables, there are some more types namely local and global variables, Predefined variables, Constant variables. Let's see these.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Local and Global variables:&lt;/b&gt; Local variables are available to that particular function in which they are defined where as gloabal variables are available to the entire script.&lt;br /&gt;
&lt;br /&gt;
Predefined or (superglobals) variables: In all PHP scripts, a set of predefined variables are available to you. You might have seen some of these variables in the output of the phpinfo() function. Some of these predefined variables are called superglobals, meaning that they are always present and available to all of your scripts, without any intervention by you, the programmer.&lt;br /&gt;
&lt;br /&gt;
•&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;$_GET contains any variables provided to a script through the GET method.&lt;br /&gt;
•&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;$_POST contains any variables provided to a script through the POST method.&lt;br /&gt;
•&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;$_COOKIE contains any variables provided to a script through a cookie.&lt;br /&gt;
•&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;$_FILES contains any variables provided to a script through file uploads.&lt;br /&gt;
•&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;$_ENV contains any variables provided to a script as part of the server environment.&lt;br /&gt;
•&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;$_SESSION contains any variables that are registered in a session.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Constant variables:&lt;/b&gt; A constant is an identifier for a value that cannot change during the course of a script. Once a constant has a value, it remains through its execution lifetime. Constants can be user defined, or you can use some of the predefined constants that PHP always has available. Unlike simple variables, constants do not have a dollar sign before their name, and they are usually uppercase to show their difference from a scalar variable.&lt;br /&gt;
&lt;br /&gt;
Eg: define("MYCONSTANT", "Some Constant value");&lt;br /&gt;
&lt;br /&gt;
Let's see a small demo on some of these varibales.&lt;br /&gt;
&lt;br /&gt;
&lt;div style="text-align: justify;"&gt;
&lt;script class="brush:php" type="syntaxhighlighter"&gt;
&lt;?php
$intVar = "955421";
$floatVar = "1542.2232235";
$stringVar = "This is a string.";
echo "&lt;p&gt;
integer: $intVar&lt;/P&gt;";
echo "&lt;p&gt;
float: $floatVar&lt;/P&gt;";
echo "&lt;p&gt;
string: $stringVar&lt;/P&gt;";

$a = 5; //global variable
function varTest()
 {
  $a = 1; //local variable
  echo $a;
 }
varTest();
?&gt;
&lt;/script&gt;&lt;/div&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/phphunger/xvuf/~4/T-uL2laPRF4" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/phphunger/xvuf/~3/T-uL2laPRF4/understanding-php-variables.html</link><author>noreply@blogger.com (Samiullah Muhammed)</author><thr:total>2</thr:total><feedburner:origLink>http://www.phphunger.com/2012/08/understanding-php-variables.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7633149608386800006.post-8573100990375227531</guid><pubDate>Mon, 06 Aug 2012 05:32:00 +0000</pubDate><atom:updated>2013-04-01T09:53:07.663-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">PHP Developer Journey - Tutorial</category><title>Understanding PHP's structure and its syntax</title><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;span style="text-align: justify;"&gt;Let's see the structure of PHP. How to write the PHP code and its style. As we already know PHP is a scripting language like ASP, JSP. The syntax will be same like the others. Likewise every starting tag must have the corresponding ending tag. While writing the code if you do any mistake with starting and ending tags then PHP interpreter will slaps you by showing different errors with your silly mistakes. So be careful.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Let's see different styles of opening and closing tags.&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://2.bp.blogspot.com/-6yv2I1k4HOE/UB9OPyYiVGI/AAAAAAAAAMM/-qUNdc_VPeA/s1600/php-starting-ending-tags-phphunger.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="254" src="http://2.bp.blogspot.com/-6yv2I1k4HOE/UB9OPyYiVGI/AAAAAAAAAMM/-qUNdc_VPeA/s320/php-starting-ending-tags-phphunger.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;Style 1:&lt;/b&gt;&lt;br /&gt;
&lt;span style="text-align: justify;"&gt;This is the default and standards compliant starting and ending tags. This type of tags are highly encouraged for writing PHP scripting because now a days every web server is configured in such a way. So must adopt these default style of tags.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://2.bp.blogspot.com/-WUIsjajC0cs/UB9Rt3b4WEI/AAAAAAAAAMg/lLtmG-sSmIg/s1600/php-default-syntax-phphunger.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/-WUIsjajC0cs/UB9Rt3b4WEI/AAAAAAAAAMg/lLtmG-sSmIg/s1600/php-default-syntax-phphunger.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;Style 2:&lt;/b&gt;&lt;br /&gt;
These are called short tags.
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://1.bp.blogspot.com/-XUaiBF7VLf4/UB9R3omNXAI/AAAAAAAAAMo/2qtxmTA-_IE/s1600/php-short-tags-phphunger.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://1.bp.blogspot.com/-XUaiBF7VLf4/UB9R3omNXAI/AAAAAAAAAMo/2qtxmTA-_IE/s1600/php-short-tags-phphunger.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;Style 3:&lt;/b&gt;&lt;br /&gt;
These are called ASP style tags.
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://2.bp.blogspot.com/-I63NpWRHW0E/UB9SD5HyKtI/AAAAAAAAAMw/-jNobDctDH0/s1600/asp-style-tags-in-php-phphunger.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/-I63NpWRHW0E/UB9SD5HyKtI/AAAAAAAAAMw/-jNobDctDH0/s1600/asp-style-tags-in-php-phphunger.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;Style 4:&lt;/b&gt;&lt;br /&gt;
These are called HTML tags.
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://4.bp.blogspot.com/-qR0yabz7Fi0/UB9SJIARxyI/AAAAAAAAAM4/Gm1M1TQdT0k/s1600/html-style-tags-in-php-phphunger.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/-qR0yabz7Fi0/UB9SJIARxyI/AAAAAAAAAM4/Gm1M1TQdT0k/s1600/html-style-tags-in-php-phphunger.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;script language="php"&gt;&lt;/p&gt;
&lt;p&gt;
//some code&lt;/p&gt;
&lt;p&gt;
&lt;/script&gt;&lt;br /&gt;
&lt;b&gt;Style 5:&lt;/b&gt;&lt;br /&gt;
&lt;div style="text-align: justify;"&gt;
These are called special tags.&amp;nbsp;These special set of tags can be used to output the value of an expression directly to the browser.&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://2.bp.blogspot.com/-ZvR6quDfObc/UB9SP4EMSPI/AAAAAAAAANA/TPU95IElwBs/s1600/special-tags-phphunger.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/-ZvR6quDfObc/UB9SP4EMSPI/AAAAAAAAANA/TPU95IElwBs/s1600/special-tags-phphunger.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;b&gt;Note:&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div style="text-align: justify;"&gt;
Any code you write that will be between both the starting and ending tags then only the PHP interpreter understands it as a PHP code. Otherwise it will treat it as a normal text and prints as it is. So be wise while choosing the starting and ending tags.&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style="font-size: large;"&gt;Do you know PHP code can be embedded in HTML? Let's see how to do this.&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
There is one more way of embedding PHP script in HTML document. This is the actual style of writing the PHP script in the real world programming. Its highly encouraged style of writing the PHP script. Let's see the code.&lt;br /&gt;
&lt;script class="brush:php" type="syntaxhighlighter"&gt;
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;My PHP Script in HTML&lt;/TITLE&gt;
&lt;/HEAD&gt;
&lt;body&gt;
&lt;?php
echo "&lt;p&gt;
&lt;em&gt;Hello World! I'm using PHP in HTML!&lt;/em&gt;&lt;/P&gt;";
?&gt;
&lt;/BODY&gt;
&lt;/HTML&gt;
&lt;/script&gt;

I hope you enjoyed the different styles of writing PHP scripting. Thanks for reading this. Any comments and suggestions are accepted.
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/phphunger/xvuf/~4/9r6jAMG4GvQ" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/phphunger/xvuf/~3/9r6jAMG4GvQ/understanding-phps-structure-and-its.html</link><author>noreply@blogger.com (Samiullah Muhammed)</author><media:thumbnail url="http://2.bp.blogspot.com/-6yv2I1k4HOE/UB9OPyYiVGI/AAAAAAAAAMM/-qUNdc_VPeA/s72-c/php-starting-ending-tags-phphunger.jpg" height="72" width="72" /><thr:total>3</thr:total><feedburner:origLink>http://www.phphunger.com/2012/08/understanding-phps-structure-and-its.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7633149608386800006.post-4962783436107411517</guid><pubDate>Wed, 01 Aug 2012 05:01:00 +0000</pubDate><atom:updated>2013-04-01T09:57:17.078-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">PHP Developer Journey - Tutorial</category><title>PHP Developer Journey: How PHP code or script is Parsed</title><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;span style="text-align: justify;"&gt;Now you have a good knowledge about &lt;/span&gt;&lt;a href="http://www.phphunger.com/2012/07/php-developer-journey-how-to-run-php.html" style="text-align: justify;"&gt;how to run PHP code on XAMPP&lt;/a&gt;&lt;span style="text-align: justify;"&gt;. But have you ever thought about how this PHP is showing the content on the browser or how PHP is Parsed. Let's see the scenario.&lt;/span&gt;&lt;br /&gt;
&lt;div style="text-align: justify;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
Here we need to understand 2 terminology.&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;/div&gt;
&lt;ol&gt;
&lt;li&gt;Client Side and&amp;nbsp;&lt;/li&gt;
&lt;li&gt;Server Side&lt;/li&gt;
&lt;/ol&gt;
&lt;b style="text-align: justify;"&gt;Server Side :&lt;/b&gt;&lt;span style="text-align: justify;"&gt; The code which is executed or parsed on the server is called a Server Side technology. Examples are PHP, JSP, ASP, Python, Ruby etc.&lt;/span&gt;
&lt;div style="text-align: justify;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
The server always gives back response whenever cient requests. Means the server's job is to give response only.&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;b&gt;Client Side :&lt;/b&gt; The code which is executed on the browser is called a Client Side technology. Examples are Javascript, VB Script etc.&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
The client always requests to server for something to execute. Means the client's job is to request only.&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;b&gt;&lt;span style="font-size: large;"&gt;Let's see how PHP is Parsed or how PHP works?&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;ul style="text-align: left;"&gt;
&lt;li&gt;The Web browser requests a file with a .php extension.&lt;/li&gt;
&lt;li style="text-align: justify;"&gt;The Web server gives response as, "Hey! Someone wants a PHP file, which means this is a file that needs to be parsed," and sends the request on to the PHP parser.&lt;/li&gt;
&lt;li&gt;The PHP parser finds the requested file and scans it for PHP code.&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://2.bp.blogspot.com/-y9-lrFVAbnQ/UBiziNmt5bI/AAAAAAAAAL4/VO2inUX8JPo/s1600/how-php-is-parsed-phphunger.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="160" src="http://2.bp.blogspot.com/-y9-lrFVAbnQ/UBiziNmt5bI/AAAAAAAAAL4/VO2inUX8JPo/s400/how-php-is-parsed-phphunger.jpg" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;ul style="text-align: left;"&gt;
&lt;li style="text-align: justify;"&gt;When the PHP parser finds PHP code, it executes that code and places the resulting output (if any) into the place in the file formerly occupied by the code.&lt;/li&gt;
&lt;li style="text-align: justify;"&gt;This new output file is sent back to the Web server.&lt;/li&gt;
&lt;li style="text-align: justify;"&gt;The Web server sends it along to the Web browser.&lt;/li&gt;
&lt;li style="text-align: justify;"&gt;The Web browser displays the output.&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;
&lt;b&gt;&lt;span style="font-size: large;"&gt;Let's see how any website works on WWW?&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div style="text-align: justify;"&gt;
The&amp;nbsp;
processing&amp;nbsp;of any website irrespective of the language we used in it, the processing will be same whether its a PHP website or ASP website or JSP website. Let's see the different steps.&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;ul style="text-align: left;"&gt;
&lt;li style="text-align: justify;"&gt;When you type a website address for instance &lt;b&gt;http://www.phphunger.com/&lt;/b&gt; and hit enter. What actually happens is that the browser sends a request to the server for the index.php page.&amp;nbsp;&lt;/li&gt;
&lt;li style="text-align: justify;"&gt;The web server sends the index.php page to the web application server where it is parsed.&amp;nbsp;&lt;/li&gt;
&lt;li style="text-align: justify;"&gt;If there is any requirement of database connectivity in the index.php, it is connected to the database for the desired purpose and the database returns the result.&amp;nbsp;&lt;/li&gt;
&lt;li style="text-align: justify;"&gt;Over all at web application server the index.php page is actually parsed to an html document which is send back to the web server.&amp;nbsp;&lt;/li&gt;
&lt;li style="text-align: justify;"&gt;The web server sends back the requested page to the client (browser) where you can view the requested page.&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/phphunger/xvuf/~4/d4qm5ZOyVBY" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/phphunger/xvuf/~3/d4qm5ZOyVBY/php-developer-journey-how-php-code-or.html</link><author>noreply@blogger.com (Samiullah Muhammed)</author><media:thumbnail url="http://2.bp.blogspot.com/-y9-lrFVAbnQ/UBiziNmt5bI/AAAAAAAAAL4/VO2inUX8JPo/s72-c/how-php-is-parsed-phphunger.jpg" height="72" width="72" /><thr:total>2</thr:total><feedburner:origLink>http://www.phphunger.com/2012/07/php-developer-journey-how-php-code-or.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7633149608386800006.post-3183648200494699531</guid><pubDate>Thu, 26 Jul 2012 07:13:00 +0000</pubDate><atom:updated>2013-04-01T10:03:50.872-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">PHP Developer Journey - Tutorial</category><title>PHP Developer Journey: How to run PHP code or script with XAMPP</title><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;div style="text-align: justify;"&gt;
&lt;span style="background-color: white;"&gt;Hi all, i hope you liked my previous post regarding working with XAMPP. If you don't know then please read it. Please find here&amp;nbsp;&lt;a href="http://www.phphunger.com/2012/07/php-developer-journey-how-to-use-xampp.html"&gt;How to use XAMPP for developing PHP Web Applications&lt;/a&gt;.&lt;/span&gt;&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
Now let's see &lt;b&gt;how to run PHP code or PHP script using XAMPP&lt;/b&gt;. Let's get started.&lt;/div&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://4.bp.blogspot.com/-D6YAZalUINk/UBDMlJJzbPI/AAAAAAAAALE/HVzDkbeSGgk/s1600/client-server.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="171" src="http://4.bp.blogspot.com/-D6YAZalUINk/UBDMlJJzbPI/AAAAAAAAALE/HVzDkbeSGgk/s400/client-server.jpg" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;Step 1:&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div style="text-align: justify;"&gt;
Start XAMPP Control Panel Application and start &lt;b&gt;Apache and MySQL services&lt;/b&gt;. If you don't know how to Start XAMPP and its services please see &lt;a href="http://www.phphunger.com/2012/07/php-developer-journey-how-to-use-xampp.html"&gt;here&lt;/a&gt;.&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;Step 2:&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div style="text-align: justify;"&gt;
&lt;ol&gt;
&lt;li&gt;&lt;span style="background-color: white;"&gt;To run PHP code or PHP script you need a file. So create a file with a name called "myFirstPHPScript.php".&amp;nbsp;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="background-color: white;"&gt;To create a file you should have any editor like Notepad or Notepad++. I suggest you to download Notepad++ for ease of writing the code. You can download from here &lt;/span&gt;&lt;a href="http://notepad-plus-plus.org/download/v6.1.5.html" style="background-color: white;" target="_blank"&gt;Notepad++&lt;/a&gt;&lt;span style="background-color: white;"&gt;.&amp;nbsp;&lt;/span&gt;&lt;span style="background-color: white;"&gt;Once you have downloaded, install it on to your machine and then write the following code in the Notepad++ editor.&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;u style="background-color: white;"&gt;&lt;b&gt;File Name : &lt;/b&gt;&lt;i&gt;myFirstPHPScript.php&lt;/i&gt;&lt;/u&gt;&lt;br /&gt;
&lt;script class="brush:php" type="syntaxhighlighter"&gt;
&lt;?php
echo "Hello World! This is my first PHP code snippet!!";
?&gt;
&lt;/script&gt;

OMG! I have written my first PHP code. It seems so simple. Yes, Its so simple if you keep on following my articles.
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style="font-size: large;"&gt;Where to save PHP files and folders?&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div style="text-align: justify;"&gt;
As you have written your PHP code now you will be confused about the file that where should i save the file. The XAMPP gives you a directory for storing all PHP files or folders in the "&lt;b&gt;&lt;i&gt;&lt;u&gt;htdocs"&lt;/u&gt;&lt;/i&gt;&lt;/b&gt; directory which i already discussed in my previous article.&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;&lt;u&gt;Local Storage Location of PHP files and folders:&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div style="text-align: justify;"&gt;
Lets see the location of &lt;b&gt;htdocs&lt;/b&gt; directory. See the below picture to find the location of &lt;b&gt;"htdocs"&lt;/b&gt; directory.&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://2.bp.blogspot.com/-cP05ml_PVPs/UBDXjP-2k7I/AAAAAAAAALQ/WjWfTDViE94/s1600/htdocs-location-xampp-phphunger.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="331" src="http://2.bp.blogspot.com/-cP05ml_PVPs/UBDXjP-2k7I/AAAAAAAAALQ/WjWfTDViE94/s400/htdocs-location-xampp-phphunger.png" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;&lt;u&gt;Note:&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
&lt;ol style="text-align: left;"&gt;
&lt;li&gt;&lt;span style="background-color: white;"&gt;Every PHP file or PHP Project must be stored in this htdocs directory.&lt;/span&gt;&lt;/li&gt;
&lt;li style="text-align: justify;"&gt;&lt;span style="background-color: white;"&gt;If its a big project then keep all the PHP, HTML, CSS, JavaScript files in one folder and place them in the htdocs directory.&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;b&gt;&lt;u&gt;Remote Storage Location of PHP files and folders:&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div style="text-align: justify;"&gt;
Let's see the remote storage location of PHP files and folders. Like htdocs in local system, &lt;b&gt;httpdocs&lt;/b&gt; in the remote system where you will store all the PHP files and folders. See the below picture.&lt;/div&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://1.bp.blogspot.com/-SZ4mz-4li5s/UBDfnGZapdI/AAAAAAAAALc/A9q6rxhqVdM/s1600/local-remote-locations-phphunger.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="211" src="http://1.bp.blogspot.com/-SZ4mz-4li5s/UBDfnGZapdI/AAAAAAAAALc/A9q6rxhqVdM/s400/local-remote-locations-phphunger.png" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;&lt;u&gt;Note :&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
&lt;ol style="text-align: left;"&gt;
&lt;li style="text-align: justify;"&gt;&lt;span style="background-color: white;"&gt;For storing files or folders in the remote location you need to use a tool called FileZilla. I have already discussed about this tool in my other article &lt;/span&gt;&lt;a href="http://www.phphunger.com/2012/07/php-developer-journey-how-to-use-xampp.html" style="background-color: white;"&gt;please visit this for better understanding&lt;/a&gt;&lt;span style="background-color: white;"&gt;.&lt;/span&gt;&lt;/li&gt;
&lt;li style="text-align: justify;"&gt;&lt;span style="background-color: white;"&gt;Simply transfer the files from local system to remote system by using the respective credentials like hostname, username, password and port number for the respective website. Here our scope is for local system only. How to work with Remote system will be covered in future articles. Just keep this in mind.&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;div style="text-align: justify;"&gt;
As you have written the code, saved the file and what's left. Now how can i run this code. I am eagerly waiting to see the result of my code. Let's see.&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;b&gt;&lt;span style="font-size: large;"&gt;How to run the PHP code or PHP Script?&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;ol&gt;
&lt;li&gt;&lt;span style="background-color: white;"&gt;Open any web browser(Chrome, IE, Firefox, Safari, Opera etc.)&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="background-color: white;"&gt;Simply type &lt;b&gt;http://localhost/&lt;/b&gt;&lt;/span&gt;&lt;b&gt;myFirstPHPScript.php&lt;/b&gt; in the address bar. See below picture.&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://2.bp.blogspot.com/-N1SEZpAnPUo/UBDmKpNkv-I/AAAAAAAAALo/9zWkUXeVli4/s1600/localhost-path-phphunger.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="160" src="http://2.bp.blogspot.com/-N1SEZpAnPUo/UBDmKpNkv-I/AAAAAAAAALo/9zWkUXeVli4/s400/localhost-path-phphunger.png" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;b&gt;&lt;span style="font-size: large;"&gt;Points to remember about the PHP code file:&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;&lt;span style="background-color: white;"&gt;Every PHP file you write must start with the &lt;/span&gt;&lt;b style="background-color: white;"&gt;&amp;lt;?php&lt;/b&gt;&lt;span style="background-color: white;"&gt; and ends with &lt;/span&gt;&lt;b style="background-color: white;"&gt;?&amp;gt;&lt;/b&gt;&lt;span style="background-color: white;"&gt;. Its a must rule for every PHP file. If you forgot to write like this then &lt;b&gt;PHP Parser&lt;/b&gt; simply treats the file as a text file and displays the content as it is.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="background-color: white;"&gt;Every PHP file must be saved with &lt;b&gt;".php"&lt;/b&gt; extension.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="background-color: white;"&gt;The PHP file name may be a combination of letters or lower case and upper case letters or combination of letters with numbers.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="background-color: white;"&gt;A single PHP file may contain as many as starting and closing tags. Like see below code.
&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;div&gt;
&lt;script class="brush:php" type="syntaxhighlighter"&gt;
&amp;lt;?php
echo "Hello World! This is my first PHP code snippet!!";
?&amp;gt;
&amp;lt;?php
echo "Hello World! This is 2nd opening and closing tag!!";
?&amp;gt;
&amp;lt;?php
echo "Hello World! This is 3rd opening and closing tag!!";
?&amp;gt;
&amp;lt;?php
echo "Hello World! This is 4th opening and closing tag!!";
?&amp;gt;
&lt;/script&gt;
&lt;/div&gt;
Now you know how to run any kind of PHP script or code or project. But how its working. How its showing the content on the web browser. If you want to know all these things then wait till my next article publishes. Till then try to do experiments with the code.&lt;br /&gt;
&lt;br /&gt;
The bottom line for you is &lt;b&gt;&lt;i&gt;"If you want to become a good developer then first start making mistakes with your code then see the results then automatically you will become a good developer."&lt;/i&gt;&lt;/b&gt;&lt;/div&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/phphunger/xvuf/~4/Xh20miH30Rc" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/phphunger/xvuf/~3/Xh20miH30Rc/php-developer-journey-how-to-run-php.html</link><author>noreply@blogger.com (Samiullah Muhammed)</author><media:thumbnail url="http://4.bp.blogspot.com/-D6YAZalUINk/UBDMlJJzbPI/AAAAAAAAALE/HVzDkbeSGgk/s72-c/client-server.jpg" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://www.phphunger.com/2012/07/php-developer-journey-how-to-run-php.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7633149608386800006.post-3595455191124307523</guid><pubDate>Mon, 23 Jul 2012 05:45:00 +0000</pubDate><atom:updated>2013-04-01T10:06:21.492-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">PHP Developer Journey - Tutorial</category><title>PHP Developer Journey: How to use XAMPP for developing PHP Web Applications</title><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;div&gt;
&lt;div style="text-align: justify;"&gt;
Hi all, i am back with my PHP Developer's Journey - Tutorial for the next session. I hope you alread read the XAMPP installation on Windows. If you don't know how to install XAMPP then please refer this &lt;a href="http://www.phphunger.com/2012/07/php-developer-journey-xampp.html" rel="nofollow"&gt;article.&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div style="text-align: justify;"&gt;
Now let's get started with our next session about How to run XAMPP and How to work with XAMPP to run PHP Web Applications? Let's move on.&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;span style="background-color: white;"&gt;&lt;b&gt;&lt;span style="font-size: large;"&gt;Where XAMPP control panel stays?&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div style="text-align: justify;"&gt;
See the below picture. Navigate to the &lt;b&gt;&lt;i&gt;Start&lt;/i&gt;&lt;/b&gt; button then look for "&lt;i&gt;&lt;b&gt;XAMPP For Windows&lt;/b&gt;&lt;/i&gt;".&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://4.bp.blogspot.com/-dBwJqx39ff8/UAo-izyzLMI/AAAAAAAAAJc/Ijl2P3tYOwM/s1600/xampp-start-phphunger-1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="239" src="http://4.bp.blogspot.com/-dBwJqx39ff8/UAo-izyzLMI/AAAAAAAAAJc/Ijl2P3tYOwM/s320/xampp-start-phphunger-1.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
By clicking on the XAMPP Control Panel, it will take to the XAMPP Control Panel.&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;b&gt;Note: &lt;/b&gt;By default, XAMPP Control Panel sits at the Desktop. You can open it from there also.&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;b&gt;&lt;span style="font-size: large;"&gt;How XAMPP Control Panel looks like?&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
See the below picture if you want to see how XAMPP Control Panel looks like.&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://1.bp.blogspot.com/-4_d4fZ-KUM8/UApB47pYczI/AAAAAAAAAJo/ZhQDAxOZvcU/s1600/xampp-cp-phphunger-2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="286" src="http://1.bp.blogspot.com/-4_d4fZ-KUM8/UApB47pYczI/AAAAAAAAAJo/ZhQDAxOZvcU/s320/xampp-cp-phphunger-2.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
The XAMPP Control Panel Application shows you different modules like Apache Web Server, MySQL Database Server, FileZilla Server, Mercury Mail Server etc..etc.&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;b&gt;&lt;span style="font-size: large;"&gt;Let's See What is the functionality of different modules present in XAMPP Control Panel Application?&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;b&gt;Apache :&lt;/b&gt;&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;/div&gt;
&lt;ol style="text-align: left;"&gt;
&lt;li style="text-align: justify;"&gt;&lt;span style="background-color: white;"&gt;Apache is the world's largest &lt;b&gt;Open Source Web Server&lt;/b&gt; for running PHP applications.&lt;/span&gt;&lt;/li&gt;
&lt;li style="text-align: justify;"&gt;&lt;span style="background-color: white;"&gt;Since PHP is a Server Side Scripting Language, so to work with PHP we should &amp;nbsp;have installed one web server in our computer and that server's name is Apache.&amp;nbsp;&lt;/span&gt;&lt;/li&gt;
&lt;li style="text-align: justify;"&gt;&lt;span style="background-color: white;"&gt;Whenever we want to work with PHP we should have installed a web server. If we don't have a web server then we can't run PHP applications.&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;b&gt;MySQL :&amp;nbsp;&lt;/b&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;ol style="text-align: left;"&gt;
&lt;li style="text-align: justify;"&gt;&lt;span style="background-color: white;"&gt;MySQL is the world's largest &lt;b&gt;Open Source Database Server&lt;/b&gt;.&lt;/span&gt;&lt;/li&gt;
&lt;li style="text-align: justify;"&gt;&lt;span style="background-color: white;"&gt;It's purpose is to store and retrieve the information.&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;b&gt;Note :&lt;/b&gt; To work with MySQL you must be familiar with &lt;b&gt;SQL (Structure Query Language)&lt;/b&gt;. Don't get panic basics will be covered in future tutorials.&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;b&gt;FileZilla :&amp;nbsp;&lt;/b&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;ol style="text-align: left;"&gt;
&lt;li style="text-align: justify;"&gt;&lt;span style="background-color: white;"&gt;FileZilla is the world's largest &lt;/span&gt;&lt;b style="background-color: white;"&gt;Open Source FTP (File Transfer Protocol).&lt;/b&gt;&lt;/li&gt;
&lt;li style="text-align: justify;"&gt;&lt;span style="background-color: white;"&gt;It's&lt;/span&gt;&lt;b style="background-color: white;"&gt;&amp;nbsp;&lt;/b&gt;&lt;span style="background-color: white;"&gt;purpose is to transfer files from localhost (Local System) to remote host (Remote System).&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;b&gt;Mercury :&amp;nbsp;&lt;/b&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;ol style="text-align: left;"&gt;
&lt;li style="text-align: justify;"&gt;&lt;span style="background-color: white;"&gt;The &lt;b&gt;Mercury is a Mail Server&lt;/b&gt; - a program that sends and receives mail on behalf of a group of users on a machine or local area network.&amp;nbsp;&lt;/span&gt;&lt;/li&gt;
&lt;li style="text-align: justify;"&gt;&lt;span style="background-color: white;"&gt;Mail from the outside world is received by Mercury and placed in the addressee's mailbox, where the user can access it at any later point.&amp;nbsp;&lt;/span&gt;&lt;/li&gt;
&lt;li style="text-align: justify;"&gt;&lt;span style="background-color: white;"&gt;Messages sent by local users to the outside world are passed to Mercury, which then takes whatever steps are necessary to deliver them, removing the burden from the user's workstation and allowing him to continue with other work.&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;b&gt;Note :&amp;nbsp;&lt;/b&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div style="text-align: justify;"&gt;
To run all these modules, simply click &lt;b&gt;&lt;i&gt;Start&lt;/i&gt;&lt;/b&gt;&amp;nbsp;button besides it.&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;b&gt;&lt;span style="font-size: large;"&gt;Other options in XAMPP Control Panel Application:&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://1.bp.blogspot.com/-azfwQWlHKqU/UApV3LlvI8I/AAAAAAAAAJ0/5qOICqpLoZA/s1600/xampp-other-options-phphunger.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="291" src="http://1.bp.blogspot.com/-azfwQWlHKqU/UApV3LlvI8I/AAAAAAAAAJ0/5qOICqpLoZA/s320/xampp-other-options-phphunger.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div style="text-align: justify;"&gt;
&lt;b&gt;Shell :&amp;nbsp;&lt;/b&gt;&lt;/div&gt;
&lt;ol style="text-align: left;"&gt;
&lt;li style="text-align: justify;"&gt;&lt;span style="background-color: white;"&gt;It opens a Command Shell (DOS Prompt) at the root of your XAMPP installation with a correctly set environment for working with a Command Line Interface (including a temporary Path).&amp;nbsp;&lt;/span&gt;&lt;/li&gt;
&lt;li style="text-align: justify;"&gt;&lt;span style="background-color: white;"&gt;With the newer Control Panel, the &lt;b&gt;&lt;i&gt;xampp_shell.bat&lt;/i&gt;&lt;/b&gt; will be created the first time you open the XAMPP Shell.&amp;nbsp;&lt;/span&gt;&lt;/li&gt;
&lt;li style="text-align: justify;"&gt;&lt;span style="background-color: white;"&gt;The file (&lt;b&gt;&lt;i&gt;xampp_Shell.bat&lt;/i&gt;&lt;/b&gt;) that runs the Command Shell will be in the root of XAMPP, so if you want - you can open it with an editor and see what it does.&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://2.bp.blogspot.com/-eUQTMkrC5z4/UApWaSFtRqI/AAAAAAAAAJ8/2R_dXhciI-8/s1600/xampp-shell-phphunger-3.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="126" src="http://2.bp.blogspot.com/-eUQTMkrC5z4/UApWaSFtRqI/AAAAAAAAAJ8/2R_dXhciI-8/s320/xampp-shell-phphunger-3.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;Setup :&amp;nbsp;&lt;/b&gt;&lt;br /&gt;
&lt;ol style="text-align: left;"&gt;
&lt;li&gt;&lt;span style="background-color: white;"&gt;It opens up a set up screen which you already know about this file when you install XAMPP you would have seen it i guess. It simply shows different options. Please read the different options and do what ever you want to do. See below screen for better understanding.&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://1.bp.blogspot.com/-yhKYaanuwVQ/UApqoHh3Z_I/AAAAAAAAAKI/kX3qSGFxzjg/s1600/xampp-setup-phphunger-4.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="136" src="http://1.bp.blogspot.com/-yhKYaanuwVQ/UApqoHh3Z_I/AAAAAAAAAKI/kX3qSGFxzjg/s320/xampp-setup-phphunger-4.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;Port-Check :&amp;nbsp;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;ol style="text-align: left;"&gt;
&lt;li&gt;&lt;span style="background-color: white;"&gt;This port-check option takes you to the window which shows different services of installed XAMPP modules like Apache, MySQL, FileZilla, Mercury, Tomcat with their assigned port numbers.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="background-color: white;"&gt;Different modules have different port numbers assigned to them.&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;div&gt;
&lt;b&gt;Note :&amp;nbsp;&lt;/b&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;ul style="text-align: left;"&gt;
&lt;li&gt;&lt;span style="background-color: white;"&gt;Default port number for Apache HTTP Service is 80&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="background-color: white;"&gt;Default port number for MySQL service is 3306&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="background-color: white;"&gt;Default port number for FileZilla FTP service is 21&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="background-color: white;"&gt;Default port number for Mercury service is 25&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="background-color: white;"&gt;Default port number for Tomcat is 8080&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://1.bp.blogspot.com/-EaNJcM2WYuE/UApth6UIIeI/AAAAAAAAAKU/7AI3SzSLxJE/s1600/xampp-portcheck-phphunger-5.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="131" src="http://1.bp.blogspot.com/-EaNJcM2WYuE/UApth6UIIeI/AAAAAAAAAKU/7AI3SzSLxJE/s320/xampp-portcheck-phphunger-5.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;Explore :&amp;nbsp;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;ol style="text-align: left;"&gt;
&lt;li&gt;&lt;span style="background-color: white;"&gt;Explore option will take you to the actual location of XAMPP installation directory. i.e C:\ directory which i have installed it on C:\ in my previous demo.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="background-color: white;"&gt;This is the directory which contains all the files and folders of XAMPP Control Panel. Means different services like Apache, MySQL, PHP, phpMyAdmin, etc. Please see all but never ever delete any of them. If you do so then you might face problems with installed modules. So be careful.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="background-color: white;"&gt;It consists of the main folder called &lt;b&gt;&lt;i&gt;"htdocs"&lt;/i&gt;&lt;/b&gt; which is the root directory where every PHP application or PHP file or PHP project will be stored.&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://4.bp.blogspot.com/-k-kJaf2oTvQ/UApwKI8pjZI/AAAAAAAAAKg/Y-ezaFhAwWQ/s1600/xampp-explore-phphunger-6.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="130" src="http://4.bp.blogspot.com/-k-kJaf2oTvQ/UApwKI8pjZI/AAAAAAAAAKg/Y-ezaFhAwWQ/s320/xampp-explore-phphunger-6.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;SCM:&lt;/b&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
This will show different windows installed services. As we already know about this &lt;b&gt;&lt;i&gt;services.ini&lt;/i&gt;&lt;/b&gt; file. See below picture.&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://3.bp.blogspot.com/-c2baYeyCCK0/UApwpOJ-Q5I/AAAAAAAAAKo/c80rnu8Tivc/s1600/xampp-scm-services-phphunger-7.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="125" src="http://3.bp.blogspot.com/-c2baYeyCCK0/UApwpOJ-Q5I/AAAAAAAAAKo/c80rnu8Tivc/s320/xampp-scm-services-phphunger-7.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
There are some other options like "Refresh", "Help" and "Exit" available. Use Exit for closing the XAMPP Control Panel Application.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style="font-size: large;"&gt;Starting and Running Apache, MySQL Services :&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://3.bp.blogspot.com/-Ez2EsVNRGNg/UAp6wtDaKOI/AAAAAAAAAK0/zhfDs4jCgCU/s1600/xampp-running-phphunger-8.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="293" src="http://3.bp.blogspot.com/-Ez2EsVNRGNg/UAp6wtDaKOI/AAAAAAAAAK0/zhfDs4jCgCU/s320/xampp-running-phphunger-8.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;b&gt;&lt;span style="font-size: large;"&gt;Points to remember:&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;ol style="text-align: left;"&gt;
&lt;li&gt;&lt;span style="background-color: white;"&gt;Before going to run your &lt;b&gt;PHP application or PHP file or PHP project folder&lt;/b&gt;, you should start the &lt;b&gt;Apache Service&lt;/b&gt; simply by clicking the &lt;b&gt;Start&lt;/b&gt; button in the &lt;b&gt;XAMPP Control Panel Application&lt;/b&gt;. See the above picture.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="background-color: white;"&gt;If the PHP file is having a database interaction then &lt;b&gt;MySQL service&lt;/b&gt; should be started. Otherwise SQL queries will not be executed. So choose the options wisely. But by default start both Apache and MySQL services.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="background-color: white;"&gt;To run any PHP related application the file must be stored in &lt;i&gt;&lt;b&gt;"&lt;/b&gt;&lt;/i&gt;&lt;b&gt;&lt;i&gt;htdocs"&lt;/i&gt;&lt;/b&gt;&amp;nbsp;folder. This is the root of the Apache web server.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="background-color: white;"&gt;Here you might get one doubt regarding MySQL, that How to access MySQL? For that, XAMPP is blessed with a tool for running SQL queries. The tool is "&lt;b&gt;&lt;i&gt;phpMyAdmin&lt;/i&gt;&lt;/b&gt;".&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="background-color: white;"&gt;The phpMyAdmin gives you all the options for running SQL queries. Like how to create a table, how to insert the data in the table, how to delete the data from the table etc. You will come to know about this in MySQL tutorial.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="background-color: white;"&gt;In the rest of your PHP programming world you will always use one word called &lt;b&gt;&lt;i&gt;"localhost"&lt;/i&gt;&lt;/b&gt;. So what is a localhost?&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="background-color: white;"&gt;Localhost is the default name for describing the local computer address. Its IP address is &lt;b&gt;127.0.0.1.&lt;/b&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;div&gt;
That's all for now. In the next session we will see how to run PHP applications using localhost. What's the role of localhost in running PHP applications etc etc...&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/phphunger/xvuf/~4/kz3f6sXtNNQ" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/phphunger/xvuf/~3/kz3f6sXtNNQ/php-developer-journey-how-to-use-xampp.html</link><author>noreply@blogger.com (Samiullah Muhammed)</author><media:thumbnail url="http://4.bp.blogspot.com/-dBwJqx39ff8/UAo-izyzLMI/AAAAAAAAAJc/Ijl2P3tYOwM/s72-c/xampp-start-phphunger-1.png" height="72" width="72" /><thr:total>2</thr:total><feedburner:origLink>http://www.phphunger.com/2012/07/php-developer-journey-how-to-use-xampp.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7633149608386800006.post-3637821510372203720</guid><pubDate>Thu, 19 Jul 2012 06:13:00 +0000</pubDate><atom:updated>2013-04-01T10:10:31.285-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">PHP Developer Journey - Tutorial</category><title>PHP Developer Journey: XAMPP installation on Windows 7 in easy steps</title><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;div style="text-align: justify;"&gt;
&lt;span style="background-color: white;"&gt;Hello all, let's start our PHP developer journey now. I hope you already read my post regarding how to become a PHP Developer? If you are still unaware of it then please go through it. It's &lt;a href="http://www.phphunger.com/2012/07/how-to-become-good-php-web-developer.html" target="_blank"&gt;here&lt;/a&gt;.&lt;/span&gt;&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
To become a good PHP developer you must first make your hands dirty by accessing this tool and installing it on to your machine. The tool's name is XAMPP. Its Free tool which is available &lt;a href="http://www.apachefriends.org/en/xampp-windows.html" target="_blank"&gt;here&lt;/a&gt;. I suggest you to download an "Installer" version. Once the downloading completes, what you have to do is, just wait for some time. We will have a small introduction on XAMPP.&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style="font-size: large;"&gt;So, what is XAMPP? What is its usage?&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://1.bp.blogspot.com/-uGRLtYaYq7g/UAeK13rsbSI/AAAAAAAAAFk/MTsGo-kjF6c/s1600/xampp_phphunger.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="106" src="http://1.bp.blogspot.com/-uGRLtYaYq7g/UAeK13rsbSI/AAAAAAAAAFk/MTsGo-kjF6c/s320/xampp_phphunger.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;span style="background-color: white;"&gt;1. XAMPP is the acronym for X-Cross Platform(Windows,Linux,Solaris,Mac) + A-Apache + M-MySQL + P-PHP + P-Perl. See the above picture for clear details.&lt;/span&gt;&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;span style="background-color: white;"&gt;2. Its open source and free. Developed and maintained by a community called "Apache Friends".&lt;/span&gt;&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;span style="background-color: white;"&gt;3. With this tool any web developer or designer can develop the webiste without accessing the internet on their local machine.&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style="font-size: large;"&gt;Installation and Running of XAMPP&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Step 1:&amp;nbsp;&lt;/b&gt;&lt;br /&gt;
&lt;div style="text-align: justify;"&gt;
&lt;span style="background-color: white;"&gt;As every windows user knows how to install a .exe file. But anyhow its my responsibilty to show you the steps for installing XAMPP on windows machine. Double click on the downloaded version of XAMPP. The file looks like xampp-win32-1.7.3.exe for me. May be the version changed for you when you started downloading. Don't worry. Whatever the version the installation steps are same for all. Now see the below screen how it looks like.&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://1.bp.blogspot.com/-lFQmL6-CgsI/UAeNTPQCZ7I/AAAAAAAAAFw/-1f2L8lTChc/s1600/xampp_installation_1_phphunger.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="188" src="http://1.bp.blogspot.com/-lFQmL6-CgsI/UAeNTPQCZ7I/AAAAAAAAAFw/-1f2L8lTChc/s320/xampp_installation_1_phphunger.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;b&gt;Note:&lt;/b&gt;&amp;nbsp;&lt;br /&gt;
&lt;div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;span style="background-color: white;"&gt;From the above picture, you can see the XAMPP installation stores&amp;nbsp;&lt;/span&gt;&lt;span style="background-color: white;"&gt;by default&lt;/span&gt;&lt;span style="background-color: white;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="background-color: white;"&gt;in the &lt;b&gt;C:/&lt;/b&gt; directory. But its your wish wherever you want to store you can store it, but by default its in &lt;b&gt;C:/&lt;/b&gt; directory. Use the default directory.&lt;/span&gt;&lt;span style="background-color: white;"&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;span style="background-color: white;"&gt;&lt;b&gt;Step 2:&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div style="text-align: justify;"&gt;
&lt;span style="background-color: white;"&gt;Start you XAMPP installation by clicking on the "install" button. The installation goes on. See the below screen.&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;span class="fullpost"&gt;&lt;a href="http://1.bp.blogspot.com/-80-3inEOUQ8/UAeOdsrkgZI/AAAAAAAAAF4/4EK9lsHq_a8/s1600/xampp_installation_2_phphunger.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="239" src="http://1.bp.blogspot.com/-80-3inEOUQ8/UAeOdsrkgZI/AAAAAAAAAF4/4EK9lsHq_a8/s320/xampp_installation_2_phphunger.png" width="320" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style="background-color: white;"&gt;&lt;b&gt;Step 3:&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div style="text-align: justify;"&gt;
&lt;span style="background-color: white;"&gt;Once the above screen disappears you will see a Black Screen like Command Prompt screen in which you will be asked to do some configurations. Don't get scared the steps are simple. See the below screen. The black screen will ask you to "Add shortcuts of XAMPP on desktop or not". If you want to add it onto the desktop then type 'y' or else 'n' and press "Enter".&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://1.bp.blogspot.com/-YBXNTiBv-eI/UAePaOY1KdI/AAAAAAAAAGA/Yu62ZU10Ye0/s1600/xampp_installation_3_phphunger.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="218" src="http://1.bp.blogspot.com/-YBXNTiBv-eI/UAePaOY1KdI/AAAAAAAAAGA/Yu62ZU10Ye0/s320/xampp_installation_3_phphunger.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span style="background-color: white;"&gt;&lt;b&gt;Step 4:&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;
&lt;span style="background-color: white;"&gt;In this step it will prompt you to configure the XAMPP paths correctly. Here you will have 2 options 'y' for XAMPP path configuration correctly and 'x' to exit the setup. So type 'y' for configuring the XAMPP path correctly&amp;nbsp;&lt;/span&gt;&lt;span style="background-color: white;"&gt;and press "Enter"&lt;/span&gt;&lt;span style="background-color: white;"&gt;. See below screen.&lt;/span&gt;&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://3.bp.blogspot.com/-nKZ_fsjPwBk/UAeRBGvHOdI/AAAAAAAAAGI/uAWbEBq-co8/s1600/xampp_installation_4_phphunger.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="217" src="http://3.bp.blogspot.com/-nKZ_fsjPwBk/UAeRBGvHOdI/AAAAAAAAAGI/uAWbEBq-co8/s320/xampp_installation_4_phphunger.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span style="background-color: white;"&gt;&lt;b&gt;Step 5:&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;
&lt;span style="background-color: white;"&gt;In this step, it will prompt you to "make portable XAMPP without drive letters". Actually i don't understand the difference between selecting both the options. So blindly i typed 'n'. I suggest you to enter 'n' only&amp;nbsp;&lt;/span&gt;&lt;span style="background-color: white;"&gt;and press "Enter"&lt;/span&gt;&lt;span style="background-color: white;"&gt;. See below screen.&lt;/span&gt;&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://4.bp.blogspot.com/-BSRZ0ucID6Y/UAeWaLKtC8I/AAAAAAAAAGU/9zYcwr31zIs/s1600/xampp_installation_5_phphunger.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="220" src="http://4.bp.blogspot.com/-BSRZ0ucID6Y/UAeWaLKtC8I/AAAAAAAAAGU/9zYcwr31zIs/s320/xampp_installation_5_phphunger.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span style="background-color: white;"&gt;&lt;b&gt;Step 6:&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;
&lt;span style="background-color: white;"&gt;In this step, it will show you the different option. Simply press "Enter". See below screen.&lt;/span&gt;&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://4.bp.blogspot.com/-CE5i6hj89A8/UAeYw_UJ0DI/AAAAAAAAAGc/XdIhnbobY1s/s1600/xampp_installation_6_phphunger.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="218" src="http://4.bp.blogspot.com/-CE5i6hj89A8/UAeYw_UJ0DI/AAAAAAAAAGc/XdIhnbobY1s/s320/xampp_installation_6_phphunger.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span style="background-color: white;"&gt;&lt;b&gt;Step 7:&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;
&lt;span style="background-color: white;"&gt;In this step, by default it will configure the time zone settings and location settings based on your geographic location in the files called 'php.ini' and 'my.ini'. So simply press "Enter". See below screen.&lt;/span&gt;&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://4.bp.blogspot.com/-8kaXGsWU5IM/UAeZV0f4KjI/AAAAAAAAAGk/IV5nwp1pxVQ/s1600/xampp_installation_7_phphunger.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="218" src="http://4.bp.blogspot.com/-8kaXGsWU5IM/UAeZV0f4KjI/AAAAAAAAAGk/IV5nwp1pxVQ/s320/xampp_installation_7_phphunger.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span style="background-color: white;"&gt;&lt;b&gt;Step 8:&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;
&lt;span style="background-color: white;"&gt;In this step, it will prompt you to "start XAMPP" or do some modifications of existing made configurations if you want. But its not necessary. Simply type 'x' to complete the installation&lt;/span&gt;&lt;span style="background-color: white;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="background-color: white;"&gt;and press "Enter"&lt;/span&gt;&lt;span style="background-color: white;"&gt;. See below screen.&lt;/span&gt;&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://3.bp.blogspot.com/-7vOARoJCfzQ/UAeaV_wvpxI/AAAAAAAAAGs/1cHF0vNjpmU/s1600/xampp_installation_9_phphunger.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="250" src="http://3.bp.blogspot.com/-7vOARoJCfzQ/UAeaV_wvpxI/AAAAAAAAAGs/1cHF0vNjpmU/s320/xampp_installation_9_phphunger.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span style="background-color: white;"&gt;&lt;div style="text-align: justify;"&gt;
&lt;span style="background-color: white;"&gt;That's all for now. I hope you understand how to install XAMPP. If you have any queries or find any difficulties in installing XAMPP on to your machine then don't worry i have a comments section you post your comments and queries there. In the next article, we will see how to use XAMPP tool for developing PHP Web Applications and PHP projects. Happy coding.&lt;/span&gt;&lt;/div&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/phphunger/xvuf/~4/WXjXRxs8GyA" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/phphunger/xvuf/~3/WXjXRxs8GyA/php-developer-journey-xampp.html</link><author>noreply@blogger.com (Samiullah Muhammed)</author><media:thumbnail url="http://1.bp.blogspot.com/-uGRLtYaYq7g/UAeK13rsbSI/AAAAAAAAAFk/MTsGo-kjF6c/s72-c/xampp_phphunger.jpg" height="72" width="72" /><thr:total>2</thr:total><feedburner:origLink>http://www.phphunger.com/2012/07/php-developer-journey-xampp.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7633149608386800006.post-5792479788110150854</guid><pubDate>Tue, 17 Jul 2012 10:48:00 +0000</pubDate><atom:updated>2013-04-01T10:15:13.486-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">PHP Developer Journey - Tutorial</category><category domain="http://www.blogger.com/atom/ns#">PHP</category><title>How to become a good PHP Web Developer?</title><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;div style="text-align: justify;"&gt;
Hello every one, i hope you already read my post about "The advantages of becoming a PHP Developer", if not then go and read it. You can find &lt;a href="http://www.phphunger.com/2012/07/advantages-of-becoming-php-web.html" target="_blank"&gt;here&lt;/a&gt;. Now the time has come to become a PHP Developer. Lets see how to become a PHP Developer or a PHP Ninja?&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://1.bp.blogspot.com/-D9iunWQzyjA/UAVLVeZJV5I/AAAAAAAAAFQ/js0smPPyLTo/s1600/php_web_developer_phphunger.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="256" src="http://1.bp.blogspot.com/-D9iunWQzyjA/UAVLVeZJV5I/AAAAAAAAAFQ/js0smPPyLTo/s320/php_web_developer_phphunger.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
Becoming a PHP Ninja is not a tedious task if you follow the strategy with small plans. Someone said "Rome is not built in a single day". So keep this in mind that Rome is not built in a single day. So PHP is also not built in a single day. It took years to built then the fruitful results came into existence. Likewise you can't learn all the stuff in a single day. It will take some time to master all the things. As we already know a famous quote "Slow and steady wins the race". So start you PHP journey with slow and steady steps. One fine day you will be called as a PHP Ninja. Now lets start our PHP journey.&lt;br /&gt;&lt;br /&gt;
&lt;br /&gt;
What Benjamin Franklin said is: &lt;b&gt;"Being ignorant is not so much a shame as being unwilling to learn to do things the right way."&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Today in this competitive world everyone is busy with their busy schedules. Everyone is hardly finding the time to go and learn something in the market. Even if they had the zeal to learn they can't find enough time to learn the technology like PHP. PHP is such a technology which makes you a billionaire if you master it properly. But the problem with this is why should i learn when i can hire some skilled PHP guy who makes money for me and make my happy living. This is for those people who thinks like this. If you follow these tips of mine then definitely you will become a PHP Ninja. Before start learning PHP we must need some nuts and bolts. So see the nuts and bolts below. Lets start it.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style="font-size: large;"&gt;What are the requirements to become a PHP Web Developer or PHP Ninja?&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;To become a PHP Developer one must have enough patience. If you lack patience then i suggest you to practice some patience tips.&lt;/li&gt;
&lt;li&gt;To be able to solve simple mathematical calculations like which we did in our schooling days.(Algebra, etc). For example, if a=2, b=3 then what is a+b? If you can solve this then its enough.&lt;/li&gt;
&lt;li&gt;To be able to read the existing code. CaN yOu rEaD tHiS?&lt;/li&gt;
&lt;li&gt;&lt;b&gt;HTML&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;CSS&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;JavaScript&lt;/li&gt;
&lt;li&gt;&lt;b&gt;PHP&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;SQL (Go for any RDBMS, but i personally suggest you to opt for &lt;b&gt;MySQL&lt;/b&gt;)&lt;/li&gt;
&lt;li&gt;Any Web Server preferably Apache&lt;/li&gt;
&lt;li&gt;Any Operating System preferably Windows or else Linux&lt;/li&gt;
&lt;li&gt;Any text editor for writing the code. Like Notepad++, Dreamweaver, Editplus, Eclipse, etc..&lt;/li&gt;
&lt;li&gt;Any web browser like Firefox, Internet Explorer, Chrome, Safari, etc.&lt;/li&gt;
&lt;li&gt;Any file sharing or file transfer tool like FTP, CuteFTP, FileZilla, etc.&lt;/li&gt;
&lt;li&gt;OMG. I forgot to mention the most important tool which is a must for PHP Developer. Yes, its none other than XAMPP or WAMP or MAMP. You will come to know about these in the upcoming articles. For now keep these things with you.&lt;/li&gt;
&lt;li&gt;Of all these things, as a good developer if one forgets ctrl+c(Copy) and ctrl+v(Paste) then he/she will not be treated as good developer. So keep these two shortcuts because in the rest of your programming world you will be addicted to these two things.LOL.&lt;/li&gt;
&lt;/ol&gt;
Don't get scared by seeing the above list. Because its only the list which is made by a human being. Have you heard the fact about the history of Calgary Tower. &lt;b&gt;"The Calgary Tower stands at 190.8 meters. The total weight of the tower is 10,884 tons, of which 6,349 tons is below ground (approximately 60%). This shows that some of the greatest buildings have the strongest foundations. Just like a great building stands on a strong foundation, so does success. And the foundation of success is attitude."&lt;/b&gt; And if you have a right attitude to learn PHP then ultimately success will be yours.&lt;br /&gt;
&lt;br /&gt;
Finally a small motivation tip for you. &lt;b&gt;"Start by doing what is necessary then what is possible..and suddenly you are doing the impossible..Bravo dude.."&lt;/b&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/phphunger/xvuf/~4/MERkUgDYG80" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/phphunger/xvuf/~3/MERkUgDYG80/how-to-become-good-php-web-developer.html</link><author>noreply@blogger.com (Samiullah Muhammed)</author><media:thumbnail url="http://1.bp.blogspot.com/-D9iunWQzyjA/UAVLVeZJV5I/AAAAAAAAAFQ/js0smPPyLTo/s72-c/php_web_developer_phphunger.jpg" height="72" width="72" /><thr:total>10</thr:total><feedburner:origLink>http://www.phphunger.com/2012/07/how-to-become-good-php-web-developer.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7633149608386800006.post-8038545411521579368</guid><pubDate>Thu, 12 Jul 2012 05:21:00 +0000</pubDate><atom:updated>2013-04-01T10:21:19.799-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">PHP Developer Journey - Tutorial</category><category domain="http://www.blogger.com/atom/ns#">PHP</category><title>Advantages of becoming a PHP Web Developer</title><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;div style="text-align: justify;"&gt;
&lt;span style="background-color: white;"&gt;Let me proudly popularize my favorite technology PHP to you. Since PHP's birth i.e, 1994, it got tremendous popularity in internet world. Almost millions of the websites are using PHP as a major technology. In this article i am not going to tell you PHP's history. Since you will find more about the history of PHP in many websites in the internet. So let me tell you the advantages of becoming PHP Developer and PHP.&lt;/span&gt;&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;span style="font-size: large;"&gt;&lt;b&gt;Do you know how many domains are registered till&amp;nbsp;July&amp;nbsp;2012?&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div style="text-align: justify;"&gt;
&lt;span style="background-color: white;"&gt;According to whois.sc and dailychanges.com, there are around 140 million unique domians registered till july 2012. From these 140 million domains, surprisingly 77% of the domains use PHP as the technology and according to netcraft, 64% of domains are installed on Apache web server. Isn't it amazing?&lt;/span&gt;&lt;/div&gt;
&lt;table cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-FZQvwjy7pZk/T_0natpJzsI/AAAAAAAAAEc/FTnVXvdHEkw/s1600/serverside_tech_usage_phphunger.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="145" src="http://1.bp.blogspot.com/-FZQvwjy7pZk/T_0natpJzsI/AAAAAAAAAEc/FTnVXvdHEkw/s320/serverside_tech_usage_phphunger.jpg" width="320" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;Market share of PHP usage&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;table cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-Fnq9PgtSetI/T_0nhDd3rEI/AAAAAAAAAEk/7JPGZwpMgvo/s1600/webserver_usage_phphunger.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="174" src="http://1.bp.blogspot.com/-Fnq9PgtSetI/T_0nhDd3rEI/AAAAAAAAAEk/7JPGZwpMgvo/s320/webserver_usage_phphunger.png" width="320" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;Market share of web server usage&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;div style="text-align: justify;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;span style="font-size: large;"&gt;&lt;div style="text-align: justify;"&gt;
&lt;b style="background-color: white;"&gt;Let us see some major giants who uses PHP.&amp;nbsp;&lt;/b&gt;&lt;/div&gt;
&lt;/span&gt;
&lt;div style="text-align: justify;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;table cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-TM4sVHjEBmM/T_0nD29PB3I/AAAAAAAAAEU/bbf6FHeiAMo/s1600/php_giants_phphunger.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="182" src="http://4.bp.blogspot.com/-TM4sVHjEBmM/T_0nD29PB3I/AAAAAAAAAEU/bbf6FHeiAMo/s320/php_giants_phphunger.jpg" width="320" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;The internet giants who uses PHP&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;span style="background-color: white;"&gt;&lt;div style="text-align: justify;"&gt;
&lt;span style="background-color: white;"&gt;The internet giants like&amp;nbsp;&lt;/span&gt;&lt;span style="background-color: white;"&gt;Facebook,&amp;nbsp;&lt;/span&gt;&lt;span style="background-color: white;"&gt;Yahoo,&amp;nbsp;&lt;/span&gt;&lt;span style="background-color: white;"&gt;Wikipedia,&amp;nbsp;&lt;/span&gt;&lt;span style="background-color: white;"&gt;Flickr,&amp;nbsp;&lt;/span&gt;&lt;span style="background-color: white;"&gt;Photobucket,&amp;nbsp;&lt;/span&gt;&lt;span style="background-color: white;"&gt;Digg,&amp;nbsp;&lt;/span&gt;&lt;span style="background-color: white;"&gt;WordPress,&amp;nbsp;&lt;/span&gt;&lt;span style="background-color: white;"&gt;Joomla,&amp;nbsp;&lt;/span&gt;&lt;span style="background-color: white;"&gt;Drupal,&amp;nbsp;&lt;/span&gt;&lt;span style="background-color: white;"&gt;Friendster&amp;nbsp;&lt;/span&gt;&lt;span style="background-color: white;"&gt;and many more uses PHP.&lt;/span&gt;&lt;/div&gt;
&lt;/span&gt;
&lt;div style="text-align: justify;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;span style="background-color: white;"&gt;If i keep on saying about PHP users there is a list which is non-ending. So let me stop this and continue with my actual topic.&lt;/span&gt;&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;b style="background-color: white;"&gt;&lt;div style="text-align: justify;"&gt;
&lt;b style="background-color: white;"&gt;&lt;span style="font-size: large;"&gt;Lets see the advantages of becoming a PHP Developer.&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;/b&gt;
&lt;br /&gt;
&lt;ul style="text-align: left;"&gt;
&lt;li style="text-align: justify;"&gt;&lt;span style="background-color: white;"&gt;Since PHP is open source. Open source means free. No need to buy any licence or anything else. Its available free in the market. Means anyone can use without any hesitation. Simply anyone can start their own business by becoming a PHP Web Developer.&lt;/li&gt;
&lt;li style="text-align: justify;"&gt;&lt;span style="background-color: white;"&gt;If you feel bored going to office everyday and work under peer pressure then you should become a PHP Developer.&lt;/span&gt;&lt;/li&gt;
&lt;li style="text-align: justify;"&gt;&lt;span style="background-color: white;"&gt;If you know PHP, you can start your own websites and earn money.&lt;/span&gt;&lt;/li&gt;
&lt;li style="text-align: justify;"&gt;&lt;span style="background-color: white;"&gt;Most people under estimated PHP as a small technology, but see the market share of PHP, its dominating the internet world. Almost all companies are using PHP.&lt;/span&gt;&lt;/li&gt;
&lt;li style="text-align: justify;"&gt;&lt;span style="background-color: white;"&gt;By becoming a PHP Developer anyone can develop any kind of website like from a small static website to big dynamic websites like&amp;nbsp;Facebook, youtube etc.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;table cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-2TorZZKsF_Q/T_1Cd9g1JnI/AAAAAAAAAEw/TVU2x_oFuaM/s1600/phpdeveloper_phphunger.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="165" src="http://1.bp.blogspot.com/-2TorZZKsF_Q/T_1Cd9g1JnI/AAAAAAAAAEw/TVU2x_oFuaM/s320/phpdeveloper_phphunger.jpg" width="320" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;php developer advantages&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;ul style="text-align: left;"&gt;
&lt;li style="text-align: justify;"&gt;&lt;span style="background-color: white;"&gt;The major thing is if you don't like to work under any company then PHP is best option for you. Why because PHP is such a technology which gives you employment from home itself. Means you can start working from your home itself. Of course, to start your own business somehow you should have worked under someone. Its must if you want to become a good PHP Developer.&lt;/span&gt;&lt;/li&gt;
&lt;li style="text-align: justify;"&gt;&lt;span style="background-color: white;"&gt;The most funniest part of PHP is, every PHP program starts with a dollar($) symbol which means it indirectly gives you a sign that how to earn money by becoming a PHP Developer. LOL...just kidding. of course, definitely you can earn money in dollars with PHP.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;b&gt;&lt;span style="font-size: large;"&gt;Lets see the advantages of PHP:&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;ul style="text-align: left;"&gt;
&lt;li style="text-align: justify;"&gt;&lt;span style="background-color: white;"&gt;&lt;b&gt;Open Source:&lt;/b&gt; PHP is an open source technology, which means its source code, development environment etc. are freely available. Also, PHP community is continually developing new functionalities of this language thus improving its code package, base libraries and various classes.&lt;/span&gt;&lt;/li&gt;
&lt;li style="text-align: justify;"&gt;&lt;span style="background-color: white;"&gt;&lt;b&gt;Simple &amp;amp; Easy:&lt;/b&gt; PHP developed websites or applications have much simple code to write or understand. The level of complexity of a php code is much lesser than its competing technologies for developing web applications or dynamic sites.&lt;/span&gt;&lt;/li&gt;
&lt;li style="text-align: justify;"&gt;&lt;span style="background-color: white;"&gt;&lt;b&gt;Platform Independent: &lt;/b&gt;Applications developed in PHP are platform independent and can be executed on a variety of platforms and web servers. Websites developed using PHP can be hosted on nearly all the web-servers available in the market. The only constraint which can be considered is the version incompatibility, which is also not a major issue because most of the time servers are back-compatible with the language versions.&lt;/span&gt;&lt;/li&gt;
&lt;li style="text-align: justify;"&gt;&lt;span style="background-color: white;"&gt;&lt;b&gt;Enhanced graphics:&lt;/b&gt; PHP can be used to generate images dynamically or at run-time. Using the image functionalities, more number of image formats could be supported in a website or web application.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;table cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-kXJW-ak4NRU/T_1CsRLpQ3I/AAAAAAAAAE4/Hd7GzgtwyoQ/s1600/php_benefits_phphunger.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="255" src="http://3.bp.blogspot.com/-kXJW-ak4NRU/T_1CsRLpQ3I/AAAAAAAAAE4/Hd7GzgtwyoQ/s320/php_benefits_phphunger.jpg" width="320" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;advantages of php&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;ul style="text-align: left;"&gt;
&lt;li style="text-align: justify;"&gt;&lt;span style="background-color: white;"&gt;&lt;b&gt;Cheaper:&lt;/b&gt; PHP applications are much cheaper than other technologies for developing dynamic sites or applications due to the proprietary or license issues. PHP is freely available which helps to cut the cost of development to a considerable extent.&lt;/span&gt;&lt;/li&gt;
&lt;li style="text-align: justify;"&gt;&lt;span style="background-color: white;"&gt;&lt;b&gt;More Secured:&lt;/b&gt; Provides a more secured website due to its high quality encryption scheme. Applications safety is another advantage in the same category so that the application code cannot be tampered.&lt;/span&gt;&lt;/li&gt;
&lt;li style="text-align: justify;"&gt;&lt;span style="background-color: white;"&gt;&lt;b&gt;Fast:&lt;/b&gt; PHP applications provide a fast browsing experience due to the reason that all the processing is performed at the server side. Therefore, despite of the system configuration of the user, a website or an application developed in PHP loads equally.&lt;/span&gt;&lt;/li&gt;
&lt;li style="text-align: justify;"&gt;&lt;b&gt;Cost Effective:&lt;/b&gt; PHP Development is a better option for organizations having limited budget. Free to download, PHP development makes sure that it can meet needs of all types of customers.&lt;/li&gt;
&lt;li style="text-align: justify;"&gt;&lt;b&gt;User Friendly:&lt;/b&gt; Designed in a user friendly manner, PHP gives more flexibility than C, C++ and ASP and overall helps in increasing traffic to the site.&lt;/li&gt;
&lt;li style="text-align: justify;"&gt;&lt;b&gt;Simple Navigation:&lt;/b&gt; Adding to the list, PHP &amp;nbsp;has simple navigation that is easily understood and learnt. Users don't have to face any sort of broken or complicated links. This ensures that PHP provides a straightforward solution and efficient page loading.&amp;nbsp;&lt;/li&gt;
&lt;li style="text-align: justify;"&gt;&lt;b&gt;Compatibility:&lt;/b&gt; &amp;nbsp;The most common problem faced with other programming languages is that they are compatible with all servers. But thanks to PHP application which is versatile and allows you to enjoy the support and is completely friendly even with Linux.&amp;nbsp;&lt;/li&gt;
&lt;li style="text-align: justify;"&gt;&lt;b&gt;Huge Database:&lt;/b&gt; PHP development language has the capability of handling a huge database which provides a better management. Almost it works with all databases.&lt;/li&gt;
&lt;li style="text-align: justify;"&gt;&lt;b&gt;Integration:&lt;/b&gt; PHP integrates well with HTML which means that PHP code can be integrated with HTML code. &amp;nbsp;&lt;/li&gt;
&lt;li style="text-align: justify;"&gt;&lt;b&gt;Why PHP:&lt;/b&gt; &amp;nbsp;This programming language serves as a complete and cost effective solution. &amp;nbsp;Appreciated both by designers and developers PHP is the language that matches suits with the need and convenience.&lt;/li&gt;
&lt;li style="text-align: justify;"&gt;&lt;b&gt;Web hosting: &lt;/b&gt;There are so many hosting companies for hosting PHP websites with less cost and easy maintenance.&lt;/li&gt;
&lt;li style="text-align: justify;"&gt;&lt;b&gt;Operating System support:&lt;/b&gt; PHP supports multiple platforms like Windows, Linux, Unix, Solaris, Mac, Free BSD etc.&lt;/li&gt;
&lt;li style="text-align: justify;"&gt;&lt;b&gt;Community Support:&lt;/b&gt; Since so many people are using PHP, if you struck at some place and can't find the solution then don't worry. There are so many developers out there to support you.&lt;/li&gt;
&lt;li style="text-align: justify;"&gt;&lt;b&gt;Frameworks:&lt;/b&gt; As a PHP Developer, you can use so many available frameworks without re-inventing the wheel. No need to develop the code from scratch. Use the existing frameworks or code base.&lt;/li&gt;
&lt;li style="text-align: justify;"&gt;&lt;b&gt;OOP Support:&lt;/b&gt; Biggies like Java, .Net, PHP also supports object orientation.&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;span style="background-color: white;"&gt;These are some of the advantages of PHP, if i keep on telling about PHP then the list will grow without any end. So i will stop here and i will let you learn PHP in my future articles. You will come to know the advantages of PHP when you learn it. From these things your mind rises a question regarding &lt;a href="http://www.phphunger.com/2012/07/how-to-become-good-php-web-developer.html" target="_blank"&gt;How to become a good PHP Developer and how to learn PHP?&lt;/a&gt; If you are looking for it then wait till my next article comes into&amp;nbsp;existence.&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/phphunger/xvuf/~4/U0EBsHEWtPY" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/phphunger/xvuf/~3/U0EBsHEWtPY/advantages-of-becoming-php-web.html</link><author>noreply@blogger.com (Samiullah Muhammed)</author><media:thumbnail url="http://1.bp.blogspot.com/-FZQvwjy7pZk/T_0natpJzsI/AAAAAAAAAEc/FTnVXvdHEkw/s72-c/serverside_tech_usage_phphunger.jpg" height="72" width="72" /><thr:total>3</thr:total><feedburner:origLink>http://www.phphunger.com/2012/07/advantages-of-becoming-php-web.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7633149608386800006.post-5460291216970306938</guid><pubDate>Thu, 05 Jul 2012 07:19:00 +0000</pubDate><atom:updated>2013-04-01T10:25:29.123-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">MySQL</category><category domain="http://www.blogger.com/atom/ns#">PHP</category><title>Geo Targeting : How to show different content for different geographic locations using PHP</title><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;div style="text-align: justify;"&gt;
&lt;br /&gt;
Hi all, today i will show you how to redirect visitors to their country based on their geographic location. Confused? OK let me clear you. For example if a visitor is visiting the site from USA then the content for that targeted location will be displayed to that visitor like if a visitor is from Canada the targeted content for Canada will be displayed to them and so on. Wow!! it sounds interesting. Isn't it? Yes of course. This feature is very much important in advertising a content for a specific geographic location. So this is the technology we call it as Geo targeting.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style="font-size: large;"&gt;So lets see what is Geo targeting?&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Geo targeting is a technology which displays website content for a specified targeted location. For example the visitors who are visiting the website from their location say India the respective content for India will be displayed to the Indian visitors. Likewise, for different countries users, different content will be shown to them. This technology is best for online advertising for small to large enterprises to earn more revenue. The best example for Geo targeting is Google's DFP(Double Click for Publishers).&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-size: large;"&gt;&lt;b&gt;So where this Geo targeting is going to happen?&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Generally Geo Targeting happens at the server side, means whenever a visitor is requesting the website content from their browser it sends the request to the server and the server checks the visitors ip address with the stored ip addresses in the database server. If a specific match is found for a specific country then the content targeted for that country will be shown to the visitor.&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-size: large;"&gt;&lt;b&gt;So why this Geo Targeting is important for me?&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
If you want to publish the ad to the targeted location then i suggest you to use this technology.&lt;br /&gt;
&lt;br /&gt;
Now lets get our hands dirty..&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-size: large;"&gt;&lt;b&gt;The tools to be used for Geo targeting:&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
1. Any server side programming language. In this case i am going to use PHP.&lt;br /&gt;
2. MySQL IP Address Database. This database contains at around 55000 records. So the retrival of results will be some what slower for high traffic website. So do notice this change.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style="font-size: large;"&gt;How to get the IP Addresses Database or Where can i find the IP Addresses Database?&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;&lt;b&gt;
You can find here &lt;a href="http://ipaddresslocation.org/"&gt;&lt;span style="color: #e69138;"&gt;ipaddresslocation.org&lt;/span&gt;&lt;/a&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Here you can find in the form of a text file between ip ranges. For different countries different ranges will be given. We need to convert it to one table then only we can use this database. To use this database you need to convert it text to csv to sql format. So its a time taking process. But every month they will update their database of IP addresses. Every month we need to update our database also.&lt;br /&gt;
&lt;br /&gt;&lt;b&gt;
You can find here &lt;a href="http://maxmind.com/"&gt;&lt;span style="color: #e69138;"&gt;maxmind.com&lt;/span&gt;&lt;/a&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Maxmind provides free IP address database in the csv format. Almost it provides 95% accurate results of IP addresses. But to use this database you have to covert it to sql format then import it to the database server.&lt;br /&gt;
&lt;br /&gt;
But here i am providing php as well as IP address database for free. You can download the entire project.&lt;br /&gt;
&lt;br /&gt;&lt;b&gt;&lt;span style="font-size: large;"&gt;
How i stored the different IP Addresses in the database?&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;span style="font-size: large;"&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;
Generally all the countries will have different IP addresses, in this tutorial i am converting the IP Address into IP Number. Here IP Number is nothing but an IP Address in the 32 bit decimal notation. IP address (IPv4 / IPv6) is divided into 4 sub-blocks. Each sub-block has a different weight number each powered by 256. IP number is being used in the database because it is efficient to search between a range of number in database. I will show you how to convert an ip address into ip number.&lt;br /&gt;
&lt;br /&gt;
Let us assume an ip number 122.175.35.118&lt;br /&gt;
&lt;br /&gt;
122 x 2563 &amp;nbsp;+ 175 x 2562 &amp;nbsp;+ 35 x 2561 &amp;nbsp;+ 118 x 2560 &amp;nbsp;= 2058298230 (IP Number)&lt;br /&gt;
&lt;br /&gt;
Manually if you want to store the ip numbers in the database then follow the above procedure. Other wise go for any of the available ip address databases. Once this process is over upload the database in the database server.&lt;br /&gt;
&lt;br /&gt;&lt;b&gt;
Note : &lt;/b&gt;I have a ip address database with 2 columns only namely ip number and country code.&lt;br /&gt;&lt;br /&gt;
&lt;br /&gt;
Now lets see the code:&lt;br /&gt;
&lt;script class="brush:php" type="syntaxhighlighter"&gt;
&lt;![CDATA[

&amp;lt;?php&lt;br /&gt;
//DATABASE CONFIGURATION SETTINGS&lt;br /&gt;
&amp;nbsp;$server &amp;nbsp; = 'HOSTNAME';&lt;br /&gt;
&amp;nbsp;$username = 'DATABASE_USERNAME';&lt;br /&gt;
&amp;nbsp;$password = 'DATABASE_PASSWORD';&lt;br /&gt;
&amp;nbsp;$dbname &amp;nbsp; = 'DATABASE_NAME';&lt;br /&gt;
&lt;br /&gt;
//DATABASE CONNECTION STRING&lt;br /&gt;
&amp;nbsp;$db = mysql_connect($server, $username, $password) or die(mysql_error());&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;mysql_select_db($dbname) or die(mysql_error());&lt;br /&gt;
&lt;br /&gt;
//QUERYING THE OUR DATABASE IP ADDRESS WITH INCOMING IP ADDRESS&lt;br /&gt;
&amp;nbsp;$sql = 'SELECT country FROM ip2nation WHERE ip &amp;lt; INET_ATON("'.$_SERVER['REMOTE_ADDR'].'") &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ORDER BY ip DESC LIMIT 0,1';&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;list($country) = mysql_fetch_row(mysql_query($sql));&lt;br /&gt;
&amp;nbsp;switch ($country) {&lt;br /&gt;
&amp;nbsp; case 'in':&lt;br /&gt;
&amp;nbsp; &amp;nbsp;// REDIRECT VISITORS TO INDIA..&lt;br /&gt;
&amp;nbsp; &amp;nbsp;header('Location: http://www.phphunger.com/');&lt;br /&gt;
&amp;nbsp; &amp;nbsp;exit;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; case 'us':&lt;br /&gt;
&amp;nbsp; &amp;nbsp;// REDIRECT VISITORS TO US...&lt;br /&gt;
&amp;nbsp; &amp;nbsp;header('Location: http://www.google.co.us/');&lt;br /&gt;
&amp;nbsp; &amp;nbsp;exit;&lt;br /&gt;
&amp;nbsp; &lt;br /&gt;
&amp;nbsp; case 'uk':&lt;br /&gt;
&amp;nbsp; &amp;nbsp;//REDIRECT VISITORS TO UK...&lt;br /&gt;
&amp;nbsp; &amp;nbsp;header('Location: http://www.google.co.uk/');&lt;br /&gt;
&amp;nbsp; &amp;nbsp;exit;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; default:&lt;br /&gt;
&amp;nbsp; &amp;nbsp;// REST OF THE WORLD CAN SEE THIS SITE..&lt;br /&gt;
&amp;nbsp; &amp;nbsp;header('Location: http://www.google.com/');&lt;br /&gt;
&amp;nbsp; &amp;nbsp;exit;&lt;br /&gt;
&amp;nbsp;}&lt;br /&gt;
?&amp;gt;&lt;br /&gt;

]]&gt;
&lt;/script&gt;
&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;div&gt;
&lt;div&gt;
&lt;a href="http://www.mediafire.com/?3a1dvxbu472j21i" target="_blank"&gt;&lt;b&gt;&lt;i&gt;&lt;span style="color: red;"&gt;Download full code here....&lt;/span&gt;&lt;/i&gt;&lt;/b&gt;&lt;/a&gt;&lt;br /&gt;
&lt;div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/phphunger/xvuf/~4/FyftzkpBCXY" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/phphunger/xvuf/~3/FyftzkpBCXY/geo-targeting-how-to-show-different.html</link><author>noreply@blogger.com (Samiullah Muhammed)</author><thr:total>3</thr:total><feedburner:origLink>http://www.phphunger.com/2012/07/geo-targeting-how-to-show-different.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7633149608386800006.post-533575185683204856</guid><pubDate>Fri, 29 Jun 2012 07:05:00 +0000</pubDate><atom:updated>2013-04-01T10:28:57.168-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">PHP</category><category domain="http://www.blogger.com/atom/ns#">SEO</category><title>Inbound and outbound links checker using php</title><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;span style="background-color: white; text-align: justify;"&gt;Dear friends, today i am back with one more concept in php which is very useful for every web developer/web master/website administrator. My question to you is "have you ever thought about back links which are more useful for any successful website or a blog?" For any successful online business back links are very much&amp;nbsp;crucial. Lets check how many back links your site or blog is having. Lets see how to find the total number of inbound and outbound links.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div style="text-align: justify;"&gt;
&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: justify;"&gt;
&lt;a href="http://2.bp.blogspot.com/-a4oHjnCohu0/T-1Efg6PspI/AAAAAAAAAEA/wnTSP7KbJJs/s1600/inbound-outbound-phphunger.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="220" src="http://2.bp.blogspot.com/-a4oHjnCohu0/T-1Efg6PspI/AAAAAAAAAEA/wnTSP7KbJJs/s320/inbound-outbound-phphunger.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br/&gt;
&lt;div style="text-align: justify;"&gt;
&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;b style="background-color: white;"&gt;Why should we check inbound and outbound links?&lt;/b&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;ol style="text-align: left;"&gt;
&lt;li style="text-align: justify;"&gt;We must check inbound and outbound links in our site or blog as a blogger/administrator/web master. Because we cannot remember all the incoming urls from where the visitors are visiting my site or blog and putting comments. So this code will look for every web page from where the out going links are coming. This strategy will be much useful for link building.&lt;/li&gt;
&lt;li style="text-align: justify;"&gt;For example the site is injected with some malicious code with&amp;nbsp;JavaScript&amp;nbsp;code then you can't immediately figure out from where i am getting this link. In such cases also its useful.&lt;/li&gt;
&lt;/ol&gt;
&lt;br /&gt;
&lt;div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;b&gt;How to use this script?&lt;/b&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div&gt;
&lt;div style="text-align: justify;"&gt;
Anyone can freely use this script without any hesitation. Anyone use this script on their dedicated host or a shared host or in their localhost (local system).&lt;/div&gt;
&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;b&gt;&lt;div style="text-align: justify;"&gt;
&lt;b style="background-color: white;"&gt;Lets see the code:&lt;/b&gt;&lt;/div&gt;
&lt;/b&gt;
&lt;div style="text-align: justify;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;b&gt;&lt;div style="text-align: justify;"&gt;
&lt;b style="background-color: white;"&gt;Design a small form using HTML Code:&lt;/b&gt;&lt;/div&gt;
&lt;/b&gt;
&lt;div style="text-align: justify;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;script class="brush:html" type="syntaxhighlighter"&gt;
&lt;![CDATA[
&amp;lt;HTML&amp;gt;
&amp;lt;HEAD&amp;gt;

&amp;lt;TITLE&amp;gt;Incoming and outgoing links checking in PHP - PHPHunger.com&amp;lt;/
TITLE&amp;nbsp;&amp;gt;

&amp;lt;/HEAD&amp;nbsp;&amp;gt;

&amp;lt;BODY&amp;gt;

&amp;lt;FORM method="post"&amp;gt;

Please enter the URL for which you want to calculate inbound and outbound links: &amp;lt;input type="text" name="url" value="http://" /&amp;gt;

&amp;lt;INPUT type="submit" name="submit" value="submit" /&amp;gt;

&amp;lt;/FORM&amp;gt;

&amp;lt;/BODY&amp;gt;

&amp;lt;/HTML&amp;gt;
]]&gt;
&lt;/script&gt;
&lt;div style="text-align: justify;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;b&gt;&lt;div style="text-align: justify;"&gt;
&lt;b style="background-color: white;"&gt;Add some CSS code for better look and feel:&lt;/b&gt;&lt;/div&gt;
&lt;/b&gt;
&lt;div style="text-align: justify;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;script class="brush:css" type="syntaxhighlighter"&gt;
&amp;lt;style type="text/css"&amp;gt;
body{
&amp;nbsp; &amp;nbsp; background:#0099FF;
&amp;nbsp; &amp;nbsp; margin:0px;
&amp;nbsp; &amp;nbsp; font-size:12px;
}
#wrapper{
&amp;nbsp; &amp;nbsp; margin:0 auto;
&amp;nbsp; &amp;nbsp; width:990px;
&amp;nbsp; &amp;nbsp; background:#FFFFFF;
-webkit-border-radius: 8px;
-moz-border-radius: 8px;
border-radius: 8px;
overflow:hidden;
}
#header{
background:#4FA204;
height:149px;
&amp;nbsp;&amp;nbsp;width:990px;
&amp;nbsp;&amp;nbsp;float:left;
font-size:36px;
}
&amp;lt;/style&amp;gt;
]]&gt;
&lt;/script&gt;
&lt;div style="text-align: justify;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;b style="font-weight: bold;"&gt;&lt;div style="text-align: justify;"&gt;
&lt;b style="background-color: white;"&gt;Now the real dragon enters, PHP Code:&lt;/b&gt;&lt;/div&gt;
&lt;/b&gt;

&lt;script class="brush:php" type="syntaxhighlighter"&gt;
&lt;![CDATA[
&lt;?php
    // retrieve link destinations
    function get_a_href($url){
    $url = htmlentities(strip_tags($url));
    $ExplodeUrlInArray = explode('/',$url);
    $DomainName = $ExplodeUrlInArray[2];
    $file = @file_get_contents($url);
    $h1count = preg_match_all('/(href=["|\'])(.*?)(["|\'])/i',$file,$patterns);
    $linksInArray = $patterns[2];
    $CountOfLinks = count($linksInArray);
    $InternalLinkCount = 0;
    $ExternalLinkCount = 0;
    for($Counter=0;$Counter&lt;$CountOfLinks;$Counter++)
    {
    if($linksInArray[$Counter] == "" || $linksInArray[$Counter] == "#")
    continue;
    preg_match('/javascript:/', $linksInArray[$Counter],$CheckJavascriptLink);
    if($CheckJavascriptLink != NULL)
    continue;
    $Link = $linksInArray[$Counter];
    preg_match('/\?/', $linksInArray[$Counter],$CheckForArgumentsInUrl);
    if($CheckForArgumentsInUrl != NULL)
    {
    $ExplodeLink = explode('?',$linksInArray[$Counter]);
    $Link = $ExplodeLink[0];
    }
    preg_match('/'.$DomainName.'/',$Link,$Check);
    if($Check == NULL)
    {
    preg_match('/http:\/\//',$Link,$ExternalLinkCheck);
    if($ExternalLinkCheck == NULL)
    {
    $InternalDomainsInArray[$InternalLinkCount] = $Link;
    $InternalLinkCount++;
    }
    else
    {
    $ExternalDomainsInArray[$ExternalLinkCount] = $Link;
    $ExternalLinkCount++;
    }
    }
    else
    {
    $InternalDomainsInArray[$InternalLinkCount] = $Link;
    $InternalLinkCount++;
    }
    }
    $LinksResultsInArray = array(
    'ExternalLinks'=&gt;$ExternalDomainsInArray,
    'InternalLinks'=&gt;$InternalDomainsInArray
    );
    return $LinksResultsInArray;
    }
    if(isset($_POST['submit']) &amp;&amp; $_POST['submit'] == 'submit')
    {
    $url = $_POST['url'];
    $linksInArray = get_a_href($url);
    $CountOfExternalLink = count($linksInArray['ExternalLinks']);
    $CountOfInternalLink = count($linksInArray['InternalLinks']);
    echo "&lt;h1&gt;
Linking structure&lt;/h1&gt;
";

    if(!empty($linksInArray['ExternalLinks'])){
    echo "
External Links found: (".$CountOfExternalLink.")&lt;ul&gt;";
    foreach($linksInArray['ExternalLinks'] as $key =&gt; $val){
    $val = preg_replace("/&lt;/","&lt;",$val);
    echo "
&lt;li&gt;" . htmlentities($val) . "&lt;/li&gt;
";
    }
    echo "&lt;/ul&gt;
";
    }else{
    echo "
&lt;div class=\"error\"&gt;
No External Links found&lt;/div&gt;
";
    }
    if(!empty($linksInArray['InternalLinks'])){
    echo "
Internal Links found: (".$CountOfInternalLink.")&lt;ul&gt;";
    foreach($linksInArray['InternalLinks'] as $key =&gt; $val){
    $val = preg_replace("/&lt;/","&lt;",$val);
    echo "
&lt;li&gt;" . htmlentities($val) . "&lt;/li&gt;
";
    }
    echo "&lt;/ul&gt;
";
    }else{
    echo "
&lt;div class=\"error\"&gt;
No Internal Links found&lt;/div&gt;
";
    }
    }
    ?&gt;
]]&gt;
&lt;/script&gt;

&lt;div&gt;
&lt;div style="text-align: justify;"&gt;
That's it. Now its your turn to get your hands dirty. Happy coding...&lt;/div&gt;
&lt;/div&gt;
&lt;b&gt;
&lt;/b&gt;&lt;/div&gt;
&lt;b&gt;
&lt;/b&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/phphunger/xvuf/~4/ydMYNdxinZI" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/phphunger/xvuf/~3/ydMYNdxinZI/inbound-and-outbound-links-checker.html</link><author>noreply@blogger.com (Samiullah Muhammed)</author><media:thumbnail url="http://2.bp.blogspot.com/-a4oHjnCohu0/T-1Efg6PspI/AAAAAAAAAEA/wnTSP7KbJJs/s72-c/inbound-outbound-phphunger.png" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://www.phphunger.com/2012/06/inbound-and-outbound-links-checker.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7633149608386800006.post-34723708217720787</guid><pubDate>Thu, 21 Jun 2012 10:21:00 +0000</pubDate><atom:updated>2013-04-01T10:33:21.281-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">JavaScript</category><title>JavaScript keypress, keydown and keyup events with working example</title><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;div style="text-align: justify;"&gt;
&lt;span style="background-color: white;"&gt;Hi techies, this time i am back with a real live example of&amp;nbsp;JavaScript&amp;nbsp;which deals with key events. Now let's have a look at this working example.&lt;/span&gt;
&lt;span style="background-color: white;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div style="text-align: justify;"&gt;
&lt;span style="background-color: white;"&gt;Since JavaScript allows web developers/designers to create dynamic&amp;nbsp;web pages. Let's apply the dynamic things to web page by using JavaScript events. First let us understand what is an event? Event is an action which can be detected by the JavaScript. So every element on a web page has certain events like mouse has onclick event like wise different elements have different events. Lets understand different key events and their differences.&lt;/span&gt;
&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;/div&gt;
&lt;span style="background-color: white;"&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div style="text-align: justify;"&gt;
&lt;span style="background-color: white;"&gt;&lt;span style="background-color: white;"&gt;In JavaScript, pressing a key triggers events which can be captured and handled. Three events are triggered when a key is pressed and released:&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style="background-color: white;"&gt;
&lt;/span&gt;
&lt;ol style="text-align: left;"&gt;
&lt;li style="text-align: justify;"&gt;&lt;span style="background-color: white;"&gt;keydown&lt;/span&gt;&lt;/li&gt;
&lt;li style="text-align: justify;"&gt;&lt;span style="background-color: white;"&gt;keypress&lt;/span&gt;&lt;/li&gt;
&lt;li style="text-align: justify;"&gt;&lt;span style="background-color: white;"&gt;keyup&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;div style="text-align: justify;"&gt;
&lt;span style="background-color: white;"&gt;The &lt;/span&gt;&lt;b style="background-color: white;"&gt;keydown&lt;/b&gt;&lt;span style="background-color: white;"&gt; and &lt;/span&gt;&lt;b style="background-color: white;"&gt;keypress&lt;/b&gt;&lt;span style="background-color: white;"&gt; event occurs when the key is pressed or when the user is pressing a key or holding down the key, followed immediately by the &lt;/span&gt;&lt;b style="background-color: white;"&gt;keyup&lt;/b&gt;&lt;span style="background-color: white;"&gt; event which is generated when the key is released. Means pressing a key on the keyboard is termed as keydown and keypress event in terms of&amp;nbsp;JavaScript&amp;nbsp;terminology and once the keypress/keydown event occured the immediate next event which is going to occur is keyup event.&lt;/span&gt;&lt;span style="background-color: white;"&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;span style="background-color: white;"&gt;&lt;div style="text-align: justify;"&gt;
&lt;span style="background-color: white;"&gt;Here you may got one doubt regarding keydown and keypress events. Since both the events captures the same result then what's the difference between the keypress and keydown events? Yes, its right. Since both are giving same result then what's the use of two events instead of one. For your question see below note:&lt;/span&gt;&lt;span style="background-color: white;"&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;span style="background-color: white;"&gt;&lt;div style="text-align: justify;"&gt;
&lt;b&gt;Note:&amp;nbsp;&lt;/b&gt;&lt;/div&gt;
&lt;/span&gt;
&lt;span style="background-color: white;"&gt;&lt;div style="text-align: justify;"&gt;
&lt;span style="background-color: white;"&gt;The onkeypress event works for all the keys except ALT, CTRL, SHIFT, ESC in all browsers where as onkeydown event works for all keys. Means onkeydown event captures all the keys.&lt;/span&gt;&lt;span style="background-color: white;"&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;/span&gt;&lt;div style="text-align: justify;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;span style="background-color: white;"&gt;&lt;div style="text-align: justify;"&gt;
&lt;span style="background-color: white;"&gt;Still confused with these JavaScript key events, let's look at this below working example to clear your doubt clouds from your mind.&lt;/span&gt;&lt;span style="background-color: white;"&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;/span&gt;&lt;div style="text-align: justify;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;span style="background-color: white;"&gt;&lt;div style="text-align: justify;"&gt;
&lt;span style="background-color: white;"&gt;In this example i am taking 3 buttons and a textbox. The 3 buttons are to show the live keypress, keydown and keyup events whereas the textbox is to capture the keys from the&amp;nbsp;keyboard and show it on to these three buttons.&lt;/span&gt;&lt;span style="background-color: white;"&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;/span&gt;&lt;div style="text-align: justify;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;span style="background-color: white;"&gt;&lt;div style="text-align: justify;"&gt;
&lt;span style="background-color: white;"&gt;&lt;b&gt;Example:&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;script type="syntaxhighlighter" class="brush:html"&gt;
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;JavaScript keypress, keydown and keyup events with working example - PHP Hunger&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt; 
&lt;button onkeydown="changeStatus('onkeydown');"&gt;
onkeydown : &lt;span id="onkeydown"&gt;0&lt;/span&gt;
&lt;/button&gt;
&lt;button onkeyup="changeStatus('onkeyup');"&gt;
onkeyup : &lt;span id="onkeyup"&gt;0&lt;/span&gt;
&lt;/button&gt;
&lt;button onkeypress="changeStatus('onkeypress');"&gt;
onkeypress : &lt;span id="onkeypress"&gt;0&lt;/span&gt;
&lt;/button&gt;
&lt;input type="text" maxlength="1" onkeydown="setLabel(1, 'Down');" onkeyup="setLabel(1, 'Up');" onkeypress="countPresses();"/&gt;
&lt;/body&gt;
&lt;/html&gt;
]]&gt;&lt;/script&gt;
&lt;/span&gt;
&lt;pre class="brush:html"&gt;
&lt;script language="javascript"&gt;
  changeStatus=function() {
  var count={onkeydown:0, onkeyup:0, onkeypress:0};
  return function(s) {
  ++count[s];
  document.getElementById(s).innerHTML=count[s];
  }
}();
window.document.onkeydown=function(){changeStatus('onkeydown')}
window.document.onkeyup=function(){changeStatus('onkeyup')}
window.document.onkeypress=function(){changeStatus('onkeypress')}
&lt;/script&gt;
&lt;/pre&gt;
&lt;b&gt;Note : Place the javascript code in the &lt;head&gt; tag.&lt;/b&gt;
&lt;div style="text-align: justify;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;span style="background-color: white;"&gt;From the above example, observe the change while pressing different key combinations. For example, observe a clear change for keypress event by pressing&amp;nbsp;
ALT, CTRL, SHIFT, ESC. When you do this you don't see any count increment on the keypress button where as you could see other two buttons count change.&lt;/span&gt;&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;span style="background-color: white;"&gt;Ok techies, That's all for now.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;/span&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/phphunger/xvuf/~4/NHBdjO1JS1Y" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/phphunger/xvuf/~3/NHBdjO1JS1Y/javascript-keypress-keydown-and-keyup.html</link><author>noreply@blogger.com (Samiullah Muhammed)</author><thr:total>4</thr:total><feedburner:origLink>http://www.phphunger.com/2012/06/javascript-keypress-keydown-and-keyup.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7633149608386800006.post-2022657469311818928</guid><pubDate>Wed, 13 Jun 2012 10:41:00 +0000</pubDate><atom:updated>2013-04-01T10:39:50.701-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">MySQL</category><title>Learning JOINs in MySQL database with examples</title><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;div dir="ltr" style="text-align: left;"&gt;
&lt;div style="text-align: justify;"&gt;
Since these JOINs are very complicated concept in MySQL database.&amp;nbsp;At least, for a beginner these are very hard to understand.&amp;nbsp;At least, for me when i was a beginner i was so much confused in understanding the JOINs concept. Now i don't want the beginner to face the same problem what i have faced during my initial days of development. Lets start with some real time examples. Are you ready?&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;/div&gt;
&lt;strong style="background-color: white; text-align: justify;"&gt;&lt;span style="font-size: large;"&gt;What is a JOIN?&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;
&lt;span style="background-color: white; text-align: justify;"&gt;&lt;br /&gt;&lt;/span&gt;
&lt;strong style="background-color: white; text-align: justify;"&gt;&lt;/strong&gt;&lt;span style="background-color: white; text-align: justify;"&gt;An SQL JOIN clause is used to query data from two or more tables from a MySQL database or in other words by using JOINs you can join one or more tables.&amp;nbsp;&lt;/span&gt;&amp;nbsp;&lt;br /&gt;
&lt;strong style="text-align: justify;"&gt;&lt;strong style="background-color: white;"&gt;&lt;span style="font-size: large;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/strong&gt;
&lt;strong style="text-align: justify;"&gt;&lt;strong style="background-color: white;"&gt;&lt;span style="font-size: large;"&gt;How many types of JOIN in MySQL?&lt;/span&gt;&lt;/strong&gt;&lt;/strong&gt;&amp;nbsp;&lt;br /&gt;
&lt;em style="text-align: justify;"&gt;&lt;em style="background-color: white;"&gt;&lt;br /&gt;&lt;/em&gt;&lt;/em&gt;
&lt;em style="text-align: justify;"&gt;&lt;em style="background-color: white;"&gt;Wikipedia says:&lt;/em&gt;&lt;span style="background-color: white;"&gt; According to ANSI standard there are 4 types of JOIN.&lt;/em&gt;

&lt;span style="background-color: white; text-align: justify;"&gt;1.INNER&lt;/span&gt;

&lt;span style="background-color: white; text-align: justify;"&gt;2.OUTER&lt;/span&gt;

&lt;span style="background-color: white; text-align: justify;"&gt;3.LEFT&lt;/span&gt;

&lt;span style="background-color: white; text-align: justify;"&gt;4.RIGHT&lt;/span&gt;

&lt;span style="background-color: white; text-align: justify;"&gt;As a special case, there is one more JOIN called SELF-JOIN which means a table can JOIN to itself is a SELF-JOIN.&lt;/span&gt;

&lt;span style="background-color: white;"&gt;Lets see the two tables which i am going to use in my example. The 2 tables namely &lt;/span&gt;&lt;strong style="background-color: white;"&gt;&lt;em&gt;people&lt;/em&gt;&lt;/strong&gt;&lt;span style="background-color: white;"&gt; and &lt;/span&gt;&lt;strong style="background-color: white;"&gt;&lt;em&gt;property&lt;/em&gt;&lt;/strong&gt;&lt;span style="background-color: white;"&gt; from a database called &lt;/span&gt;&lt;strong style="background-color: white;"&gt;&lt;em&gt;phphunger&lt;/em&gt;&lt;/strong&gt;&lt;span style="background-color: white;"&gt;.&lt;/span&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style="background-color: white;"&gt;&lt;br /&gt;&lt;/span&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: justify;"&gt;
&lt;a href="http://3.bp.blogspot.com/-VDlyB4lQIOY/T9heJwzsx2I/AAAAAAAAAA4/T8AYWZnKHGI/s1600/phphunger_joins.jpg" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img alt="" border="0" height="320" src="http://3.bp.blogspot.com/-VDlyB4lQIOY/T9heJwzsx2I/AAAAAAAAAA4/T8AYWZnKHGI/s320/phphunger_joins.jpg" width="268" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;/div&gt;
&amp;nbsp;
&lt;div style="text-align: justify;"&gt;
&lt;span style="background-color: white;"&gt;&lt;strong&gt;&lt;span style="font-size: large;"&gt;Step 1:&lt;/span&gt;&lt;/strong&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style="background-color: white;"&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style="background-color: white;"&gt;First create 2 tables (people and property) and insert the dump data with the following code.&lt;/span&gt;&lt;br /&gt;
&lt;span style="background-color: white;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;/div&gt;
&lt;script class="brush:sql" type="syntaxhighlighter"&gt;
&lt;![CDATA[

CREATE TABLE IF NOT EXISTS `people` (
  `id` int(10) NOT NULL AUTO_INCREMENT,
  `name` varchar(50) NOT NULL,
  `phone` int(12) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM;

INSERT INTO `people` (`id`, `name`, `phone`) VALUES
(1, 'phphunger', 1234567890),
(2, 'Larry Page', 1236547890),
(3, 'Steve Jobs', 1235468790),
(4, 'Mark Zukerberg', 1239874560);

CREATE TABLE IF NOT EXISTS `property` (
  `id` int(10) NOT NULL,
  `pid` int(10) NOT NULL,
  `website` varchar(25) NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

INSERT INTO `property` (`id`, `pid`, `website`) VALUES
(1, 1, 'www.phphunger.com'),
(2, 2, 'www.google.com'),
(2, 3, 'www.gmail.com'),
(2, 4, 'www.youtube.com'),
(3, 5, NULL),
(4, 6, 'www.facebook.com'),
(5, 7, 'www.twitter.com'),
(6, 8, 'www.linkedin.com');
]]&gt;
&lt;/script&gt;
&lt;strong style="background-color: white; text-align: justify;"&gt;&lt;span style="font-size: large;"&gt;Step 2:&lt;/span&gt;&lt;/strong&gt;&lt;span style="background-color: white; text-align: justify;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir="ltr" style="text-align: left;"&gt;
&lt;span style="background-color: white; text-align: justify;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div dir="ltr" style="text-align: left;"&gt;
&lt;span style="background-color: white; text-align: justify;"&gt;Applying different JOINs for the created tables.&lt;/span&gt;&lt;/div&gt;
&lt;div dir="ltr" style="text-align: left;"&gt;
&lt;div style="text-align: justify;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;strong style="background-color: white;"&gt;&lt;em&gt;CASE 1:&lt;/em&gt;&lt;/strong&gt;&lt;span style="background-color: white;"&gt;&amp;nbsp;&lt;br /&gt;
&lt;span style="background-color: white;"&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style="background-color: white;"&gt;Applying Regular JOIN for the 2 tables. (Regular JOIN means INNER JOIN or JOIN). Before applying JOINs to the tables lets first see what's the functionality of JOIN.&lt;/span&gt;&lt;br /&gt;
&lt;span style="background-color: white;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style="font-size: medium; text-align: justify;"&gt;
&lt;/div&gt;
&lt;script class="brush:sql" type="syntaxhighlighter"&gt;
&lt;![CDATA[
SELECT name, phone, website
FROM people
JOIN property ON people.id = property.id
LIMIT 0 , 30
]]&gt;
&lt;/script&gt;
&lt;strong style="text-align: justify;"&gt;&lt;strong style="background-color: white;"&gt;&lt;span style="font-size: large;"&gt;Functionality of a JOIN (INNER JOIN or Regular JOIN):&lt;/span&gt;&lt;/strong&gt;&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="background-color: white; font-size: small; text-align: justify;"&gt;If you perform a JOIN on the 2 tables then you will get all the matched records and the unmatched records will not be displayed.&lt;/span&gt;
&lt;br /&gt;
&lt;span style="background-color: white; font-size: small; text-align: justify;"&gt;&lt;br /&gt;&lt;/span&gt;
&lt;div style="font-size: medium; text-align: justify;"&gt;
&lt;span style="font-size: small;"&gt;Lets see the output after applying JOIN&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: justify;"&gt;
&lt;span style="font-size: small;"&gt;&lt;a href="http://2.bp.blogspot.com/-RGLcTKzUFJ8/T9hg9aTv7iI/AAAAAAAAABE/kIrg5HL5mDg/s1600/phphunger_regular_join.jpg" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img alt="" border="0" height="143" src="http://2.bp.blogspot.com/-RGLcTKzUFJ8/T9hg9aTv7iI/AAAAAAAAABE/kIrg5HL5mDg/s320/phphunger_regular_join.jpg" width="320" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: justify;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;strong style="background-color: white;"&gt;Observation :&lt;/strong&gt;&lt;span style="background-color: white;"&gt; From the above output you can judge that i have filtered the records based on their id's. So from this filtering i have obtained the matched records from both the tables. Unmatched records are not displayed here.&lt;/span&gt;
&lt;br /&gt;
&lt;span style="background-color: white;"&gt;&lt;br /&gt;&lt;/span&gt;
&lt;div style="text-align: justify;"&gt;
&lt;span style="background-color: white; font-size: small;"&gt;&lt;strong&gt;&lt;em&gt;CASE 2:&lt;/em&gt;&lt;/strong&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style="background-color: white; font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style="background-color: white; font-size: small;"&gt;Applying LEFT JOIN for both the tables.&amp;nbsp;&lt;/span&gt;&lt;span style="background-color: white;"&gt;Before applying LEFT JOIN to the tables lets first see what's the functionality of LEFT JOIN.&lt;/span&gt;&lt;br /&gt;
&lt;span style="background-color: white;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;strong style="background-color: white;"&gt;&lt;span style="font-size: large;"&gt;Functionality of a LEFT JOIN:&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="background-color: white; font-size: small; text-align: justify;"&gt;If you perform a LEFT JOIN on the 2 tables then you will get all the matched records as well as you will get an extra record for each unmatched record from the left table of the JOIN. Means from my example each column name "name" gets a mention.&lt;/span&gt;

&lt;script class="brush:sql" type="syntaxhighlighter"&gt;
&lt;![CDATA[
SELECT name, phone, website
FROM people
LEFT JOIN property ON people.id = property.id
LIMIT 0 , 30
]]&gt;
&lt;/script&gt;

&lt;span style="background-color: white; font-size: small; text-align: justify;"&gt;Lets see the output.&lt;/span&gt;
&lt;br /&gt;
&lt;span style="background-color: white; font-size: small; text-align: justify;"&gt;&lt;br /&gt;&lt;/span&gt;
&lt;div class="separator" style="clear: both; text-align: justify;"&gt;
&lt;span style="font-size: small;"&gt;&lt;a href="http://2.bp.blogspot.com/-RGLcTKzUFJ8/T9hg9aTv7iI/AAAAAAAAABE/kIrg5HL5mDg/s1600/phphunger_regular_join.jpg" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img alt="" border="0" height="143" src="http://2.bp.blogspot.com/-RGLcTKzUFJ8/T9hg9aTv7iI/AAAAAAAAABE/kIrg5HL5mDg/s320/phphunger_regular_join.jpg" width="320" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: justify;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;span style="background-color: white; font-size: small;"&gt;&lt;strong&gt;&lt;em&gt;CASE 3:&lt;/em&gt;&lt;/strong&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style="background-color: white; font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style="background-color: white; font-size: small;"&gt;Applying RIGHT JOIN for both the tables.&amp;nbsp;&lt;/span&gt;&lt;span style="background-color: white;"&gt;Before applying RIGHT JOIN to the tables lets first see what's the functionality of RIGHT JOIN.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;strong style="background-color: white;"&gt;Functionality of a RIGHT JOIN:&lt;/strong&gt;&lt;br /&gt;
&lt;strong style="background-color: white;"&gt;&lt;br /&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style="background-color: white; font-size: small; text-align: justify;"&gt;If you perform a RIGHT JOIN on the 2 tables then you will get all the matched records as well as you will get an extra record for each unmatched record from the right table of the JOIN. It means from my example from a the table called property you will get each column name "website" gets a mention.&lt;/span&gt;

&lt;br /&gt;
&lt;span style="background-color: white; font-size: small; text-align: justify;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;script class="brush:sql" type="syntaxhighlighter"&gt;
&lt;![CDATA[
SELECT name, phone, website
FROM people
RIGHT JOIN property ON people.id = property.id
LIMIT 0 , 30
]]&gt;
&lt;/script&gt;

&lt;span style="background-color: white; font-size: small; text-align: justify;"&gt;&amp;nbsp;Lets see the output.&lt;/span&gt;
&lt;br /&gt;
&lt;span style="background-color: white; font-size: small; text-align: justify;"&gt;&lt;br /&gt;&lt;/span&gt;
&lt;div class="separator" style="clear: both; text-align: justify;"&gt;
&lt;span style="font-size: small;"&gt;&lt;a href="http://2.bp.blogspot.com/-Y39zNkEcUKw/T9hnjEcWXyI/AAAAAAAAABQ/ueyHs14YeN0/s1600/phphunger_right_join.jpg" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img alt="" border="0" height="187" src="http://2.bp.blogspot.com/-Y39zNkEcUKw/T9hnjEcWXyI/AAAAAAAAABQ/ueyHs14YeN0/s320/phphunger_right_join.jpg" width="320" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: justify;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;strong style="background-color: white;"&gt;&lt;em&gt;CASE 4:&lt;/em&gt;&lt;/strong&gt;&lt;span style="background-color: white;"&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style="background-color: white; font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style="background-color: white; font-size: small;"&gt;Applying RIGHT OUTER JOIN for both the tables.&amp;nbsp;&lt;/span&gt;&lt;span style="background-color: white;"&gt;Before applying RIGHT OUTER JOIN to the tables lets first see what's the functionality of RIGHT OUTER JOIN.&lt;/span&gt;

&lt;strong style="background-color: white;"&gt;Functionality of RIGHT OUTER JOIN:&lt;/strong&gt;

&lt;/div&gt;
&lt;div&gt;
&lt;span style="background-color: white; font-size: small; text-align: justify;"&gt;RIGHT OUTER JOIN is same as RIGHT JOIN. Adding OUTER after the clause RIGHT to yield the result. Lets see the example.&lt;/span&gt;

&lt;br /&gt;
&lt;span style="background-color: white; font-size: small; text-align: justify;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;script class="brush:sql" type="syntaxhighlighter"&gt;
&lt;![CDATA[
SELECT name, phone, website
FROM people
RIGHT OUTER JOIN property ON people.id = property.id
LIMIT 0 , 30
]]&gt;
&lt;/script&gt;

&lt;strong style="background-color: white;"&gt;&lt;em&gt;CASE 5:&amp;nbsp;&lt;/em&gt;&lt;/strong&gt;&lt;br /&gt;
&lt;span style="background-color: white; font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style="background-color: white; font-size: small;"&gt;Applying LEFT OUTER JOIN for both the tables.&amp;nbsp;&lt;/span&gt;&lt;span style="background-color: white;"&gt;Before applying LEFT OUTER JOIN to the tables lets first see what's the functionality of LEFT OUTER JOIN.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;strong style="background-color: white;"&gt;Functionality of LEFT OUTER JOIN:&lt;/strong&gt;

&lt;br /&gt;
&lt;strong style="background-color: white;"&gt;&lt;br /&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style="background-color: white; font-size: small; text-align: justify;"&gt;LEFT OUTER JOIN is same as LEFT JOIN. Adding OUTER after the clause LEFT to yield the result.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style="background-color: white; font-size: small; text-align: justify;"&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style="background-color: white; font-size: small; text-align: justify;"&gt;Lets see the example.&lt;/span&gt;

&lt;br /&gt;
&lt;span style="background-color: white; font-size: small; text-align: justify;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;script class="brush:sql" type="syntaxhighlighter"&gt;
&lt;![CDATA[
SELECT name, phone, website
FROM people
LEFT OUTER JOIN property ON people.id = property.id
LIMIT 0 , 30
]]&gt;
&lt;/script&gt;
&lt;span style="background-color: white; font-size: small;"&gt;As already i mentioned above that the concept of JOINs is difficult to understand. If you find any difficulty or&amp;nbsp;&lt;/span&gt;&lt;span style="background-color: white;"&gt;If you have questions post a comment. Till then bye bye..&lt;/span&gt;&lt;br /&gt;
&lt;span style="text-align: justify;"&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style="text-align: justify;"&gt;References :&amp;nbsp;&lt;/span&gt;&lt;strong style="text-align: justify;"&gt;&lt;span style="color: #3d85c6;"&gt;http://en.wikipedia.org/wiki/Join_(SQL)&lt;/span&gt;&lt;/strong&gt;

&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/phphunger/xvuf/~4/ZOHiApsJKCI" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/phphunger/xvuf/~3/ZOHiApsJKCI/learning-joins-in-mysql-database-with.html</link><author>noreply@blogger.com (Samiullah Muhammed)</author><media:thumbnail url="http://3.bp.blogspot.com/-VDlyB4lQIOY/T9heJwzsx2I/AAAAAAAAAA4/T8AYWZnKHGI/s72-c/phphunger_joins.jpg" height="72" width="72" /><thr:total>3</thr:total><feedburner:origLink>http://www.phphunger.com/2012/06/learning-joins-in-mysql-database-with.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7633149608386800006.post-7877226918004203299</guid><pubDate>Sat, 09 Jun 2012 07:31:00 +0000</pubDate><atom:updated>2013-04-01T21:52:21.479-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">MySQL</category><category domain="http://www.blogger.com/atom/ns#">PHP</category><title>How to display MySQL table structure in HTML form using PHP</title><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
Hi hungers oops!! programming hungers, today i am posting an interesting article which mainly focuses on "How to display MySQL table structure in HTML using PHP". This is interesting article??, stop it man.This task can be done by anyone. (anyone in the sense any PHP Developer). Yes definetely anyone can do it. Anyone? Ok..If you can concentrate on my question you will be amazed. After seeing the question anyone can say 'simply fetch the mysql table records and display onto the HTML form'. Isn't it? My answer is "It's not." You have mistaken in understanding the client requirement.&lt;br /&gt;
&lt;br /&gt;
Lets see my requirement: I dont want to display my table records in HTML form, rather i want to display MySQL database's table structure like "What's table name, How many columns are ther in the table, What are the datatypes used in the table like wise." If you are confused see the picture below. A famous chinese proverb "A picture is worth a million words". Lets see the million words picture. I am just kidding. Lets see the picture.&lt;br /&gt;
&lt;table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-j2fds2Rr5n8/T9LhcxFLXGI/AAAAAAAAAlo/8_EXb4bUl3g/s1600/phphunger_showtables.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="107" src="http://2.bp.blogspot.com/-j2fds2Rr5n8/T9LhcxFLXGI/AAAAAAAAAlo/8_EXb4bUl3g/s320/phphunger_showtables.jpg" width="320" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;MySQL table structure in HTML&lt;br /&gt;
&lt;div style="text-align: left;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
Now i hope you understand what i am going to show you. Here you may get one doubt. If i want to see the table structure then i can go to phpMyAdmin and from there i can see the structure of any table by selecting the appropriate database's table then whats the need of this code. Yes definetely, you can see, but provided you can only see one table structure at one time. You can't see all tables at one time. This is the application which shows you all the tables structures.&lt;br /&gt;
&lt;br /&gt;
In this demo i will show you a single table structure from the database. Why i will show you single table structure is because i have only one table in my database. You can try out for a big database which is having multiple tables using this code. You can see multiple tables under single database using the same code. Now lets see the code.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Step 1:&lt;/b&gt;&lt;br /&gt;
First create a database called "phphunger" in the phpmyadmin. After this create a table called "websites" and paste the following code in your "phphunger" database.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush:html"&gt;
CREATE TABLE IF NOT EXISTS `websites` (&lt;br /&gt;
`id` smallint(4) unsigned NOT NULL AUTO_INCREMENT,&lt;br /&gt;
`name` varchar(255) NOT NULL DEFAULT '',&lt;br /&gt;
`visits` decimal(10,0) NOT NULL DEFAULT '0',&lt;br /&gt;
`about` text NOT NULL,&lt;br /&gt;
`type` varchar(255) NOT NULL DEFAULT '',&lt;br /&gt;
PRIMARY KEY (`id`),&lt;br /&gt;
KEY `name` (`name`,`id`)&lt;br /&gt;
) ENGINE=MyISAM &amp;nbsp;DEFAULT CHARSET=latin1;&lt;br /&gt;
&lt;/pre&gt;
&lt;b&gt;Step 2:&amp;nbsp;&lt;/b&gt;&lt;br /&gt;
Design some CSS Code and place this in &amp;lt;head&amp;gt; section of your php form. See below for CSS Code.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush:html"&gt;
&amp;lt;style type="text/css"&amp;gt;&lt;br /&gt;
{ border-right:1px solid #ccc; border-bottom:1px solid #ccc; }&lt;br /&gt;
{ background:#afb0bd; padding:5px; border-left:1px solid #ccc; border-top:1px solid #ccc; }&lt;br /&gt;
{ padding:5px; border-left:1px solid #ccc; border-top:1px solid #ccc; }&lt;br /&gt;
&amp;lt;/style&amp;gt;&lt;br /&gt;
&lt;/pre&gt;
&lt;br /&gt;
&lt;b&gt;Step 3:&lt;/b&gt;&lt;br /&gt;
Now the real hero of our application came. Yes the business logic. Copy the below code and paste it onto your PHP form. Now you are done with your task. Now see the result. Hurrah i got it...&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush:html"&gt;
&amp;lt;?php&lt;br /&gt;
/* Connect to the db */&lt;br /&gt;
$connection = mysql_connect('localhost','root','');&lt;br /&gt;
mysql_select_db('phphunger',$connection);&lt;br /&gt;
/* Show tables */&lt;br /&gt;
$result = mysql_query('SHOW TABLES',$connection) or die('Cannot show tables');&lt;br /&gt;
/* Loop through tables */&lt;br /&gt;
while($tableName = mysql_fetch_row($result)) {&lt;br /&gt;
$table = $tableName[0];&lt;br /&gt;
echo '&amp;lt;h2&amp;gt;',$table,'&amp;lt;/h2&amp;gt;';&lt;br /&gt;
$result2 = mysql_query('SHOW COLUMNS FROM '.$table) or die('Cannot show columns from '.$table);&lt;br /&gt;
if(mysql_num_rows($result2)) {&lt;br /&gt;
echo '&amp;lt;table cellpadding="0" cellspacing="0" class="db-table"&amp;gt;';&lt;br /&gt;
echo '&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Field&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Type&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Null&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Key&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Default&amp;lt;th&amp;gt;Extra&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;';&lt;br /&gt;
while($row2 = mysql_fetch_row($result2)) {&lt;br /&gt;
echo '&amp;lt;tr&amp;gt;';&lt;br /&gt;
foreach($row2 as $key=&amp;gt;$value) {&lt;br /&gt;
echo '&amp;lt;td&amp;gt;',$value,'&amp;lt;/td&amp;gt;';&lt;br /&gt;
}&lt;br /&gt;
echo '&amp;lt;/tr&amp;gt;';&lt;br /&gt;
}&lt;br /&gt;
echo '&amp;lt;/table&amp;gt;&amp;lt;br /&amp;gt;';&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&lt;/pre&gt;
&lt;br /&gt;
&lt;b&gt;Output:&lt;/b&gt;&lt;br /&gt;
&lt;table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-qeVL5aitZiQ/T9Lz9Ig-N9I/AAAAAAAAAl0/zyBvJe0tY84/s1600/phphunger_websites_structure.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="196" src="http://3.bp.blogspot.com/-qeVL5aitZiQ/T9Lz9Ig-N9I/AAAAAAAAAl0/zyBvJe0tY84/s320/phphunger_websites_structure.png" width="320" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;Structure of mysql table&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
Now you are done with the task. Now lets see how it fetches and displays in a HTML tabular format.&lt;br /&gt;
&lt;br /&gt;
1. Fetch all of the tables present in the database called "phphunger" using mysql_query() function.&lt;br /&gt;
2. Once all the tables have been fetched, then the next step is to loop through the array of tables we receive.&lt;br /&gt;
3. For each table we receive show the same received data in the tabular format in HTML form with the column information. That's it. Over.&lt;br /&gt;
&lt;br /&gt;
Now its your turn to say me hi,hello,bye kind of stuff in this comments section. If you really like this article please say thanks. If you don't like this article then curse me. Oops..hey!!! stop stop..please don't curse me. You can give some positive feedback about how to improvise next time. Till then bye...&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/phphunger/xvuf/~4/phOCyRGg3gU" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/phphunger/xvuf/~3/phOCyRGg3gU/how-to-display-mysql-table-structure-in.html</link><author>noreply@blogger.com (Samiullah ...)</author><media:thumbnail url="http://2.bp.blogspot.com/-j2fds2Rr5n8/T9LhcxFLXGI/AAAAAAAAAlo/8_EXb4bUl3g/s72-c/phphunger_showtables.jpg" height="72" width="72" /><thr:total>5</thr:total><feedburner:origLink>http://www.phphunger.com/2012/06/how-to-display-mysql-table-structure-in.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7633149608386800006.post-3663179922781282835</guid><pubDate>Fri, 08 Jun 2012 06:57:00 +0000</pubDate><atom:updated>2013-04-01T21:57:06.450-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">MySQL</category><title>How to choose optimal data types for MySQL database design</title><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;br /&gt;
&lt;div style="text-align: justify;"&gt;
&lt;span style="background-color: white;"&gt;The MySQL relational database management system (RDBMS) supports a wide range of data types. The data type that you chose for your table columns is important because it determines how MySQL will store your data. It’s possible that any one of multiple data types could be used to store a piece of data, but which one is the best or optimal data type to use? Lets see first what is a Datatype?&lt;/span&gt;&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;b&gt;&lt;div style="text-align: justify;"&gt;
&lt;b style="background-color: white;"&gt;What is a Data Type?&lt;/b&gt;&lt;/div&gt;
&lt;/b&gt;
&lt;div style="text-align: justify;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;span style="background-color: white;"&gt;In programming, classification of a particular type of information. It is easy for humans to distinguish between different types of data. We can usually tell by seeing whether a number is a percentage, a time, or an amount of money. We do this through special symbols %, :, and $ that indicate the data's type. Similarly, a computer uses special internal codes to keep track of the different types of data it processes.&lt;/span&gt;&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;span style="background-color: white;"&gt;Most programming languages require the programmer to declare the data type of every data object, and most database systems require the user to specify the type of each data field. The available data types vary from one programming language to another, and from one database application to another, but the following usually exist in one form or another: Integer, Floating-Point and Character(text).&lt;/span&gt;&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;b&gt;&lt;div style="text-align: justify;"&gt;
&lt;b style="background-color: white;"&gt;What’s Optimal?&lt;/b&gt;&lt;/div&gt;
&lt;/b&gt;&lt;div style="text-align: justify;"&gt;
&lt;span style="background-color: white;"&gt;I would define optimal as taking the least amount of storage space and/or being the fastest in terms of search or data retrieval. The &lt;/span&gt;&lt;a href="http://www.phphunger.com/2012/05/how-to-find-second-highest-value-of.html" style="background-color: white;"&gt;MySQL&lt;/a&gt;&lt;span style="background-color: white;"&gt; manual says:&lt;/span&gt;&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;i&gt;&lt;div style="text-align: justify;"&gt;
&lt;i style="background-color: white;"&gt;“For optimum storage, you should try to use the most precise type in all cases. For example, if an integer column is used for values in the range from 1 to 99999, MEDIUMINT UNSIGNED is the best type. Of the types that represent all the required values, this type uses the least amount of storage.”&lt;/i&gt;&lt;/div&gt;
&lt;/i&gt;
&lt;div style="text-align: justify;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;b&gt;&lt;div style="text-align: justify;"&gt;
&lt;b style="background-color: white;"&gt;MySQL Data Types&lt;/b&gt;&lt;/div&gt;
&lt;/b&gt;&lt;div style="text-align: justify;"&gt;
&lt;span style="background-color: white;"&gt;MySQL supports a number of data types in several categories: numeric types, date and time types, and string (character) types. Data types have been created to serve a specific purpose. Some are optimal for storing small amounts of text, others large amounts of text, others dates, others numbers etc… When creating your tables it is best practice to understand what type of data each column will be storing and choose the appropriate data type. This is a large and complex area so I aim to give a brief overview with some useful examples and tips.&lt;/span&gt;&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;b&gt;&lt;div style="text-align: justify;"&gt;
&lt;b style="background-color: white;"&gt;Example of Incorrect Data Type Usage&lt;/b&gt;&lt;/div&gt;
&lt;/b&gt;&lt;div style="text-align: justify;"&gt;
&lt;span style="background-color: white;"&gt;The TEXT data type is designed to store string types and has a maximum length of 65,535 bytes (roughly equivalent to the same number of characters). Therefore it’s intended for storing relatively large strings. The VARCHAR data type stores variable-length strings with a range of 0 to 255 before (MySQL 5.0.3). Therefore this is intended for storing relatively small strings. The storage required for TEXT columns is the length of the data plus 2 bytes, whereas the VARCHAR columns require the length of the data plus one byte. It’s not much of a saving but when you have a table with millions of records every little helps!&lt;/span&gt;&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;span style="background-color: white;"&gt;When storing a number you could theoretically use TEXT or VARCHAR data types and you’d still be able to add, edit, delete and search your data as you would expect. However, it’s much better to store the number in one of MySQL’s numeric data types. Storing a number using the optimal data type means that it uses less storage space and your table can be searched faster.&lt;/span&gt;&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;b&gt;&lt;div style="text-align: justify;"&gt;
&lt;b style="background-color: white;"&gt;Examples and Best Practices&lt;/b&gt;&lt;/div&gt;
&lt;/b&gt;
&lt;b&gt;&lt;div style="text-align: justify;"&gt;
&lt;b style="background-color: white;"&gt;Numbers&lt;/b&gt;&lt;/div&gt;
&lt;/b&gt;&lt;div style="text-align: justify;"&gt;
&lt;span style="background-color: white;"&gt;Numbers should usually be stored using one of MySQL’s numeric data types. The numeric data types that you’ll probably use most often are TINYINT, SMALLINT, MEDIUMINT, INT and DECIMAL.&lt;/span&gt;&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;span style="background-color: white;"&gt;The first four numeric data types are used to store integers (whole numbers including negative numbers) with varying minimum and maximum values. For example, TINYINT columns can store integers ranging from -128 to 127 and INT can store integers ranging from -2147483648 to 2147483647. The storage requirement for TINYINT columns is 1 byte and for INT columns it is 4 bytes. (SMALLINT and MEDIUMINT cover the numbers in between these values.) Therefore if you know that a column will hold integers ranging from 1 to 99 you should use the TINYINT data type, as it requires less storage.&lt;/span&gt;&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;b&gt;&lt;div style="text-align: justify;"&gt;
&lt;b style="background-color: white;"&gt;Unsign Your Integers!&lt;/b&gt;&lt;/div&gt;
&lt;/b&gt;&lt;div style="text-align: justify;"&gt;
&lt;span style="background-color: white;"&gt;You can extend the numeric range of these numeric data types by giving them the UNSIGNED attribute. This means that negative values are not permitted and allows TINYINT columns to store integers ranging from 0 to 255 and INT columns to store integers ranging from 0 to 4294967295. This means that you can use a data type with a smaller storage requirement for a larger number of negative values are not needed.&lt;/span&gt;&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;b&gt;&lt;div style="text-align: justify;"&gt;
&lt;b style="background-color: white;"&gt;Storing Money in MySQL&lt;/b&gt;&lt;/div&gt;
&lt;/b&gt;&lt;div style="text-align: justify;"&gt;
&lt;span style="background-color: white;"&gt;Or more accurately, storing monetary values! Whilst you could, ofcourse, store monetary values as strings (e.g. VARCHAR), the optimal data type is DECIMAL. This numeric data type is used to store exact numeric data values (i.e. numbers with a decimal point). The MySQL manual explains that DECIMAL is “used to store values for which it is important to preserve exact precision, for example with monetary data“.&lt;/span&gt;&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;span style="background-color: white;"&gt;When declaring a DECIMAL column the precision and scale are specified, for example DECIMAL(5,2). MySQL explains that:&lt;/span&gt;&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;span style="background-color: white;"&gt;“In this example, 5 is the precision and 2 is the scale. The precision represents the number of significant digits that are stored for values, and the scale represents the number of digits that can be stored following the decimal point. If the scale is 0, DECIMAL and NUMERIC values contain no decimal point or fractional part.“&lt;/span&gt;&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;b&gt;&lt;div style="text-align: justify;"&gt;
&lt;b style="background-color: white;"&gt;Strings&lt;/b&gt;&lt;/div&gt;
&lt;/b&gt;&lt;div style="text-align: justify;"&gt;
&lt;span style="background-color: white;"&gt;Strings (characters, text etc…) can also be stored using a number of different data types. The main types that you’ll come across are CHAR, VARCHAR and TEXT. As we saw previously, the TEXT data type is used to store large strings (65,535 bytes) so you’d usually use this to store larger amounts of text.&lt;/span&gt;&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;span style="background-color: white;"&gt;So what about storing short strings? Should you use CHAR or VARCHAR? Both data types can hold between 0 and 255 bytes (VARCHAR can hold up to 65,535 bytes as of MySQL 5.0.3) so how to you choose? Each data type has its advantages and disadvantages.&lt;/span&gt;&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;b&gt;&lt;div style="text-align: justify;"&gt;
&lt;b style="background-color: white;"&gt;CHAR&lt;/b&gt;&lt;/div&gt;
&lt;/b&gt;&lt;div style="text-align: justify;"&gt;
&lt;span style="background-color: white;"&gt;The length of a CHAR column is fixed to the length that you declare when you create the table, and stored values are right-padded with spaces to the specified length. So if you define a column as CHAR(255) even if you only insert a few characters the storage requirement will be 255 bytes. However, CHAR columns also have a speed advantage. Because they are fixed-length, MySQL can search CHAR columns faster than variable-length columns. However, a caveat is that the whole table must be fixed-length in order to benefit from the increased performance. If you have any other VARCHAR or TEXT columns in the table then the rows become variable-length and there is no speed increase.&lt;/span&gt;&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;b&gt;&lt;div style="text-align: justify;"&gt;
&lt;b style="background-color: white;"&gt;VARCHAR&lt;/b&gt;&lt;/div&gt;
&lt;/b&gt;&lt;div style="text-align: justify;"&gt;
&lt;span style="background-color: white;"&gt;Values in VARCHAR columns are variable-length strings. In contrast to CHAR, VARCHAR values are stored as a one-byte length prefix plus data. So as with the example above, if you define a column as VARCHAR(255) and only insert 5 characters the storage requirement will only be 6 bytes. Therefore if your strings will be of variable length, the VARCHAR data type will require less storage.&lt;/span&gt;&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;b&gt;&lt;div style="text-align: justify;"&gt;
&lt;b style="background-color: white;"&gt;CHAR vs. VARCHAR&lt;/b&gt;&lt;/div&gt;
&lt;/b&gt;&lt;div style="text-align: justify;"&gt;
&lt;span style="background-color: white;"&gt;If your table will only contain fixed-length columns then use CHAR to take advantage of MySQL’s faster searching. However, if any of your columns will be variable length then use VARCHAR for its smaller storage requirement.&lt;/span&gt;&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;b&gt;&lt;div style="text-align: justify;"&gt;
&lt;b style="background-color: white;"&gt;Dates&lt;/b&gt;&lt;/div&gt;
&lt;/b&gt;&lt;div style="text-align: justify;"&gt;
&lt;span style="background-color: white;"&gt;Whilst you could store a date as a text string, MySQL has more optimal ways of storing dates!&lt;/span&gt;&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;b&gt;&lt;div style="text-align: justify;"&gt;
&lt;b style="background-color: white;"&gt;Unix Timestamp&lt;/b&gt;&lt;/div&gt;
&lt;/b&gt;&lt;div style="text-align: justify;"&gt;
&lt;span style="background-color: white;"&gt;One perfectly valid way to store dates would be as a Unix timestamp. A Unix timestamp is a 10-digit representation of the number of seconds since the Unix epoch of 1st January 1970. This could be stored as a CHAR column, requiring 10 bytes storage, but the most optimal data type is the numeric INT(UNSIGNED) type, requiring just 4 bytes storage.&lt;/span&gt;&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;span style="background-color: white;"&gt;Unix timestamps are particularly useful if you’re using PHP, as the date() function will display them in your chosen format and you can calculate dates by adding or subtracting a number of seconds (86400 is equivalent to 24 hours etc…).&lt;/span&gt;&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;span style="background-color: white;"&gt;One drawback of using Unix timestamps is that they’re not human readable straight from the database. Would you know what date 1262986313 refers to? Another is that due to the 10-digit length, Unix timestamps may have problems at 3:14:07AM on 19th January 2038 when the value 9999999999 is reached!&lt;/span&gt;&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;b&gt;&lt;div style="text-align: justify;"&gt;
&lt;b style="background-color: white;"&gt;DATETIME&lt;/b&gt;&lt;/div&gt;
&lt;/b&gt;&lt;div style="text-align: justify;"&gt;
&lt;span style="background-color: white;"&gt;Until recently I used Unix timestamps to store dates in MySQL, but I’ve now started using the DATETIME data type. This is designed specifically to store both the date and time as 2010-01-08 15:00:00 (for example).&lt;/span&gt;&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;span style="background-color: white;"&gt;One disadvantage is that this requires 8 bytes storage – double that of a Unix timestamp. But I believe that the advantages of using DATETIME rather than Unix timestamps outweighs this disadvantage.&lt;/span&gt;&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;span style="background-color: white;"&gt;Firstly dates stored using DATETIME are human-readable straight out of the database. So if you’re browsing your data with phpMyAdmin you can see what your dates actually mean!&lt;/span&gt;&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;span style="background-color: white;"&gt;Secondly MySQL has a whole host of built-in functions to work with native DATETIME formats. You can add and subtract dates, calculate the difference between dates, output the date in your preferred format and much more using MySQL alone and without involving additional PHP (for example) scripting.&lt;/span&gt;&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;span style="background-color: white;"&gt;And finally, if you really want to output your DATETIME column as a Unix timestamp, MySQL has a built-in function to do that, too!&lt;/span&gt;&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;span style="background-color: white;"&gt;Note that MySQL can also store the year alone, the date alone and a number of related types.&lt;/span&gt;&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;b&gt;&lt;div style="text-align: justify;"&gt;
&lt;b style="background-color: white;"&gt;Miscellaneous&lt;/b&gt;&lt;/div&gt;
&lt;/b&gt;
&lt;b&gt;&lt;div style="text-align: justify;"&gt;
&lt;b style="background-color: white;"&gt;ENUM&lt;/b&gt;&lt;/div&gt;
&lt;/b&gt;&lt;div style="text-align: justify;"&gt;
&lt;span style="background-color: white;"&gt;ENUM columns provide an efficient way to define columns that can contain only a given set of values. So if a column will only ever contain ‘var 1′, ‘var 2′ or ‘var 3′ (for example), you should use the ENUM data type. Due to the way that MySQL stores the data it is much more efficient than storing the data as a string.&lt;/span&gt;&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;span style="background-color: white;"&gt;An example of when this is useful is setting a switch to specify whether a user account is active or disabled. Instead of storing ‘active’ or ‘disabled’ as VARCHAR values, use ENUM instead.&lt;/span&gt;&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;b&gt;&lt;div style="text-align: justify;"&gt;
&lt;b style="background-color: white;"&gt;Conclusion&lt;/b&gt;&lt;/div&gt;
&lt;/b&gt;&lt;div style="text-align: justify;"&gt;
&lt;span style="background-color: white;"&gt;Although data can often be stored in various data type columns, there’s usually one data type that is optimal for your data. Using that optimal data type will bring benefits in terms of storage and possibly speed, and is best practice for any website developer.&lt;/span&gt;&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="text-align: justify;"&gt;
&lt;span style="background-color: white;"&gt;For Further Reading&amp;nbsp;&lt;/span&gt;&lt;a href="http://dev.mysql.com/doc/refman/5.0/en/storage-requirements.html" style="background-color: white;"&gt;&lt;i&gt;&lt;b&gt;http://dev.mysql.com/doc/refman/5.0/en/storage-requirements.html&lt;/b&gt;&lt;/i&gt;&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/phphunger/xvuf/~4/4qbmPjEVliE" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/phphunger/xvuf/~3/4qbmPjEVliE/how-to-choose-optimal-data-types-for.html</link><author>noreply@blogger.com (Samiullah ...)</author><thr:total>0</thr:total><feedburner:origLink>http://www.phphunger.com/2012/06/how-to-choose-optimal-data-types-for.html</feedburner:origLink></item><language>en-us</language><media:rating>nonadult</media:rating></channel></rss>
