DataBase Interview Questions And Answers

 

1. What is database?

A database is a logically coherent collection of data with some inherent meaning, representing some aspect of real world and which is designed, built and populated with data for a specific purpose.

2. What is DBMS?

It is a collection of programs that enables user to create and maintain a database. In other words it is general-purpose software that provides the users with the processes of defining, constructing and manipulating the database for various applications.

3. What is a Database system?

The database and DBMS software together is called as Database system.

4. What are the advantages of DBMS?

 

  1. Redundancy is controlled.
  2. Unauthorised access is restricted.
  3. Providing multiple user interfaces.
  4. Enforcing integrity constraints.
  5. Providing backup and recovery.

 

5. What are the disadvantage in File Processing System?

 

  1. Data redundancy and inconsistency.
  2. Difficult in accessing data.
  3. Data isolation.
  4. Data integrity.
  5. Concurrent access is not possible.
  6. Security Problems.

 

6. Describe the three levels of data abstraction?

The are three levels of abstraction:

  1. Physical level: The lowest level of abstraction describes how data are stored.
  2. Logical level: The next higher level of abstraction, describes what data are stored in database and what relationship among those data.
  3. View level: The highest level of abstraction describes only part of entire database.

Data Structure Interview Questions And Answers

 

Q: What’s the major distinction in between Storage structure and file structure
 and how?
A: The expression of an specific data structure inside memory of a computer system is termed storage structure in contrast to a storage structure expression in auxiliary memory is normally known as a file structure.

Q: Explain whether Linked List is actually linear or Non-linear data structure?
A : Link list is definitely obviously linear data structure simply because each and every element (NODE) acquiring specific place and as well each and every component has got its unique successor in addition to predecessor. furthermore, linear collection of data objects referred to as nodes and also the linear order is provided by means of pointers. Every node can be separated into two parts. First part includes information of the element and another part includes the address of the subsequent node in the list.

Q: Explain simulation?
A: Simulation is the procedure for developing an fuzy model from a real situation so as to understand the effects of modifications and the effect of introducing a variety of techniques on the situation. It is a rendering with real life system by another system, which represents the important characteristics of real system and allows experiments on it.

Q: Does the minimum spanning tree of the graph provide the shortest distance between any two given nodes?
A: Minimal spanning tree ensures that the total weight of the tree is actually kept at its minimum but it really would not signify the distance between any two nodes involved in the minimum-spanning tree is actually minimum.

Q: In an AVL tree, at exactly what situation the balancing will be done?
A: If the pivotal value (or the Height factor) is above 1 or less than 1. If the balance factor of any node is other than 0 or 1 or -1 then balancing is completed. The balancing factor will be height. The variation in height of the right subtree along with right subtree need to be +1, -1 or 0

Q: What is the significant difference between ARRAY and STACK?
A: Stack ensues LIFO. Thus the item that is certainly first entered would be the last removed. In array the items could be entered or removed in any order. Basically each and every member access is done making use of index and no strict order is to be followed here to remove a particular element. Array could be multi dimensional or one dimensional but stack really should be one-dimensional.
Size of array is fixed, while stack may be grow or shrink. We can say stack is actually dynamic data structure.

HEAP AND HEAPSORT ALGORITHM

 

 

Definition of a heap

 

Heap is an almost complete binary tree where the data (key) stored in a node is larger than those of its children nodes. In other words a heap must satisfy following properties :

 

1. All internal nodes at level 0 to d-2 have degree 2, where d is the depth of the tree.

2. At level d-1, the leaves are all to the right of the internal nodes. The rightmost internal node at level d-1 may have degree 1 which can only be its left child.

3. The key at any node is greater than or equal to the keys of each of its children (if it has any).

 

Such a heap is called descending heap. In an ascending heap, on the other hand, the key value stored in a node is smaller than the keys of its children nodes. The following figure 19.1 given below depicts a descending heap.

 

 
It may be noted, in a descending heap, the root always contains the largest element. The heap is often used for storing priority queues. As we will see later, the complexity of insertion or deletion from a heap is lesser than the corresponding operations with a linear linked list. Moreover, the heap can also be used for sorting an array of elements.

 

Creation of an initial heap

 

While creating a heap from a given set of data elements (keys) one has to make sure that the basic properties of a heap must be satisfied. This is illustrated with the help of the following example.

 

Suppose that the following integer keys are read in a sequence:

5, 25, 2, 70, 49, 29, 129, 30

To begin with when the key 5 is received a single node with this value is created which is by definition is always a heap (shown in the figure 19.2a).

 

When 25 is now received, it can be attached as a left child of 5 to satisfy that the heap is a complete binary tree. Since the key value of the root is found to be smaller than the key of this newly inserted child, to maintain the descending heap order property the key values are now swapped. This results into a two elements heap as shown in the figure 19.2b.

 

The next key value received is 2 and the corresponding node is attached as right child of the root node in figure 19.2c. This results in proper heap and no further change is necessary. This process is continued with the subsequent data values and heaps thus created are shown in the following figures (19.2a – 19.2h):

 

Deletion from a heap

 

As mentioned before, the root node of a descending heap contains the maximum element. It is this key which is deleted. In order to maintain the heap structure, the key stored in the rightmost leaf node at the bottommost level is selected for insertion into the root node. Since, the key thus entered may not be larger than the data values of its children nodes, to maintain the descending heap property we should exchange it with the larger one of the two children nodes. This process should be continued till the node thus inserted finds its proper place in the heap. This process is called adjust heap. This is illustrated in figure 19.3, where the initial heap is shown figure 19.3a. The key to be deleted is 129 at the root node P. The rightmost leaf node at level 3 (W) has key value 5 and it is to be inserted at node P. Note 5 is smaller than the key values 49 and 70 stored in the children nodes Q and R of P. Hence it is necessary to exchange the key 5 stored in the node P with the key 70 of node R so that the node P has larger key than the keys of its children. At this stage, 5 moves down to node R. Again 5 is smaller than 29 stored in the child node V of R.Therefore, we exchange the keys of the nodes R and V to arrive at the heap shown in the figure 19.3b. The process is now repeated by deleting 70 and inserting the value 5 located in the rightmost child (V) in figure 19.3b. Again it is percolated down the tree so that descending heap property is maintained. This leads to figure 19.3c.

 

 

 

The algorithm for deletion from a heap is described below.

 

Algorithm : Deletion from a heap.

Input : Heap and a pointer to its root (P).

Output : Heap with one less node containing all the keys from the input heap except the one that was stored in its root.

 

 

Method :

Step 1 : Store the key value of the root at a separate place.

Step 2 :Let K be the key stored in the rightmost leaf node at the bottom most level.

Step 3 :Store K into the root (P).

Step 4 : While P is not a leaf do

Let C be the child node of P with the larger key

If K <>

Exchange the key values

Replace P by C

Else

Exit

End while

Step 5 :Store K in the node pointed to by P.

 

The heap adjustment procedure consists of the steps 2 to 5 in the above mentioned algorithm.

 

Implementation of a heap and heapsort algorithm

 

Although the binary trees are generally implemented using linked structures as described in section 18.3, an almost complete binary tree can readily be implemented using a simple one dimensional array. This is because the children of a node at a level i of such a tree can be stored at array locations 2i + 1 and 2i + 2 respectively.

 

Recall that in a heap (an almost complete binary tree) there cannot be any node at level j unless the level j – 1 is completely filled. Therefore according to this mapping scheme the nodes will be stored in the array from left to right and level by level beginning with the root (which is stored at the beginning of the array).

 

Following this mapping scheme heap in figure 19.1 can be stored in the array shown in figure 19.4

 

heap[0] heap[4] heap[9]

95 76 80 49 63 64 72 39 28 14

 

Fig. 19.4

 

Based on the mapping scheme mentioned above, an implementation of heapsort algorithm in C is given below. This routine creates an initial heap with the unsorted key values stored in the same array. After that, it successively shifts the maximum element (root) to the bottom of the array and adjust the remaining array so that it returns the heap properly.

 

EXAMPLE 19.3 :

heapsort(x,n)

int x[],n;

{

int i,data,s,f,ivalue;

/* create initial heap */

for(i=1;i <>

{

data=x[i];

/* insert_heap (x,i,data); */

s=i;

f=(s – 1) / 2; /* f is the father of s */

while(s > 0 && x[f] <>

{

x[s]=x[f]; /* move up the tree */

s=f;

f=(s – 1) / 2; /* f is the father of s */

}/* end while */

x[s]=data;

}/* end for i.e. a heap has been created */

/* begin repeatedly removing the maximum element i.e. x[0], */

/* place it at the end of the array.*/

/* Convert the remaining part to a heap */

for(i=n – 1; i > 0;i–)

{

/* delete the root */

ivalue=x[i];

x[i]=x[0]; /* the root is placed at the bottom */

f=0;

/* begin adjusting the heap by pushing the element x[i] i.e. ivalue */

if(i == 1)

s=-1;/* no further processing required */

else

s=1;

if(i > 2 && x[2] > x[1])

s=2;

while(s >=0 && ivalue <>

{

/* push ivalue down the heap */

x[f]=x[s];

f=s;

/* s=largeson(f, i-1) */

s=2*f +1; /* s is the child of f */

if(s+1 <= i-1 && x[s] <>

s=s+1; /* select the larger of the two children of f i.e. 2j + 1 or 2j + 2 */

if(s > i-1) /* when bounds have been reached */

s=-1;

}/* end while */

/* insert ivalue at fth location */

x[f]=ivalue;

}/* end for */

}/* end heap sort */

 

It may be observed, that the entire sorting procedure can be carried out in place, i.e. no separate array is required. It can be shown that the heap adjustment (as well as deletion) procedure has linear complexity i.e. of the order of n (where n is the number of keys). The heapsort algorithm does atmost 2n logn number of comparisons of keys in the worst case.

Sort each of the key sequences given in Quiz #1 using Heapsort. In each case, show the initial heap construction and adjustment of the heap as elements are removed from the heap. Also count the number of comparisons and exchanges made for sorting the key values

Css3 Interview Questions And Answers

What is CSS?
1. CSS stands for Cascading Style Sheets and is a simple styling language which allows attaching style to HTML elements. Every element type as well as every occurrence of a specific element within that type can be declared an unique style, e.g. margins, positioning, color or size.

2. CSS is a web standard that describes style for XML/HTML documents.

3. CSS is a language that adds style (colors, images, borders, margins…) to your site. It’s really that simple. CSS is not used to put any content on your site, it’s just there to take the content you have and make it pretty. First thing you do is link a CSS-file to your HTML document. Do this by adding this line:

<link rel=”stylesheet” href=”style.css”
type=”text/css”>

The line should be placed in between your <head> and </head> tags. If you have several pages you could add the exact same line to all of them and they will all use the same stylesheet, but more about that later. Let’s look inside the file “style.css” we just linked to.

h1 {
font-size: 40px;
height: 200px;
}
.warning {
color: Red;
font-weight: bold;
}
#footer {
background-color: Gray;
}

4. Cascading Style Sheets (CSS) is a simple mechanism for adding style (e.g. fonts, colors, spacing) to Web documents. This is also where information meets the artistic abilities of a web-designer. CSS helps you spice up your web-page and make it look neat in wide variety of aspects.

What are Cascading Style Sheets? 
A Cascading Style Sheet (CSS) is a list of statements (also known as rules) that can assign various rendering properties to HTML elements. Style rules can be specified for a single element occurrence, multiple elements, an entire document, or even multiple documents at once. It is possible to specify many different rules for an element in different locations using different methods. All these rules are collected and merged (known as a “cascading” of styles) when the document is rendered to form a single style rule for each element.

How do I center block-elements with CSS1? 
There are two ways of centering block level elements:

1. By setting the properties margin-left and margin-right to auto and width to some explicit value:

BODY {width: 30em; background: cyan;}
P {width: 22em; margin-left: auto; margin-right: auto}

In this case, the left and right margins will each be four ems wide, since they equally split up the eight ems left over from (30em – 22em). Note that it was not necessary to set an explicit width for the BODY element; it was done here to keep the math clean.

Another example:

TABLE {margin-left: auto; margin-right: auto; width: 400px;}
In most legacy browsers, a table’s width is by default determined by its content. In CSS-conformant browsers, the complete width of any element (including tables) defaults to the full width of its parent element’s content area. As browser become more conformant, authors will need to be aware of the potential impact on their designs.

If background and color should always be set together, why do they exist as separate properties? 
There are several reasons for this. First, style sheets become more legible — both for humans and machines. The background property is already the most complex property in CSS1 and combining it with color would make it even more complex. Second, color inherits, but background doesn’t and this would be a source of confusion.

What is class? 
Class is a group of 1) instances of the same element to which an unique style can be attached or 2) instances of different elements to which the same style can be attached.

1) The rule P {color: red} will display red text in all paragraphs. By classifying the selector P different style can be attached to each class allowing the display of some paragraphs in one style and some other paragraphs in another style.
2) A class can also be specified without associating a specific element to it and then attached to any element which is to be styled in accordance with it’s declaration. All elements to which a specific class is attached will have the same style.

To classify an element add a period to the selector followed by an unique name. The name can contain characters a-z, A-Z, digits 0-9, period, hyphen, escaped characters, Unicode characters 161-255, as well as any Unicode character as a numeric code, however, they cannot start with a dash or a digit. (Note: in HTML the value of the CLASS attribute can contain more characters). (Note: text between /* and */ are my comments).

CSS
P.name1 {color: red} /* one class of P selector */
P.name2 {color: blue} /* another class of P selector */
.name3 {color: green} /* can be attached to any element */

HTML
<P>This paragraph will be red</P>
<P>This paragraph will be blue</P>
<P>This paragraph will be green</P>
<LI>This list item will be green</LI>

It is a good practice to name classes according to their function than their appearance; e.g. P.fotnote and not P.green. In CSS1 only one class can be attached to a selector. CSS2 allows attaching more classes, e.g.:
P.name1.name2.name3 {declaration} <P>This paragraph has three classes attached</P>

What is grouping ?
Grouping is gathering (1) into a comma separated list two or more selectors that share the same style or (2) into a semicolon separated list two or more declarations that are attached to the same selector (2).

1. The selectors LI, P with class name .first and class .footnote share the same style, e.g.:
LI {font-style: italic}
P.first {font-style: italic}
.footnote {font-style: italic}

To reduce the size of style sheets and also save some typing time they can all be grouped in one list.
LI, P.first, .footnote {font-style: italic}

2. The declarations {font-style: italic} and {color: red} can be attached to one selector, e.g.:
H2 {font-style: italic}
H2 {color: red}
and can also be grouped into one list:
H2 {font-style: italic; color: red}

What is external Style Sheet? How to link? 
External Style Sheet is a template/document/file containing style information which can be linked with any number of HTML documents. This is a very convenient way of formatting the entire site as well as restyling it by editing just one file. The file is linked with HTML documents via the LINK element inside the HEAD element. Files containing style information must have extension .css, e.g. style.css. <HEAD> <LINK REL=STYLESHEET HREF=”style.css” TYPE=”text/css”> </HEAD>

Is CSS case sensitive? 
Cascading Style Sheets (CSS) is not case sensitive. However, font families, URLs to images, and other direct references with the style sheet may be.
The trick is that if you write a document using an XML declaration and an XHTML doctype, then the CSS class names will be case sensitive for some browsers.

It is a good idea to avoid naming classes where the only difference is the case, for example:

div.myclass { …}
div.myClass { … }

If the DOCTYPE or XML declaration is ever removed from your pages, even by mistake, the last instance of the style will be used, regardless of case.

Aptitude Interview Questions And Answers for freshers

  1. While traveling on a road, the road diverges left and right. one way goes to the heaven and other one goes to hell i want to go to heaven. In that village only two inhabitants are living one is knight and other one is knave. knight will always speak truth and knave will always speak lie. In that road one inhabitant is standing but we don’t know who is he. He might be an knight or knave i want to ask a question to that inhabitant to go to heaven. how can i identify that inhabitant is knight or knave
  2. These words follow a logical progression: CODIFY LAMINA STOVE RESET JOKUL QUIRES Which one of these comes next? REST, GRAIL, STOIC, ORDEAL
  3. There is a whole number n for which the following holds: if you put a 4 at the end of n, and multiply the number you get in that way by 4, the result is equal to the number you get if you put a 4 in front of n. In other words, we are looking for the number you can put on the dots in the following equation: 4… = 4 × …4 Which number must be put on the dots to get a correct equation?
  4. 361 -> 22 121 -> 14 81 -> 12 25 -> X What is the value of X?
  5. there are 4 cars . they all are coming from different directions. they have to cross through one square. they all arrive at the same time. nobody stops . still there is no clash . note : they all are driving at a speed if 100 km/hr. options are: 1) all cars take left 2) all cars turn right 3) two cars turn left and two turn right. tell me the answer with reason.
  6. The legendary king Midas possessed a huge amount of gold. He hid this treasure carefully: in a building consisting of a number of rooms. In each room there were a number of boxes; this number was equal to the number of rooms in the building. Each box contained a number of golden coins that equaled the number of boxes per room. When the king died, one box was given to the royal barber. The remainder of the coins had to be divided fairly between his six sons. Is a fair division possible in all situations?
  7. This is a most unusual paragraph. How quickly can you find out what is so unusual about it? It looks so ordinary that you would think that nothing is wrong with it at all, and, in fact, nothing is. But it is unusual. Why? If you study it and think about it, you may find out, but I am not going to assist you in any way. You must do it without any hints or coaching. No doubt, if you work at it for a bit, it will dawn on you. Who knows? Go to work and try your skill. Good luck! What is unusual about the above paragraph?

Magento is an open source eCommerce solution. It comes with a variety of tools, necessarily for building a successful online shop. Magento offers a lot of built-in capabilities, such as promo pricing and coupon codes, detailed statistics, and SEO options.

This Magento tutorial will provide you with comprehensive installation instructions for Magento shopping cart and will also show you how to create and manage a web site using Magento.

Magento tutorial covers the following topics:

  • Magento installationHow to install Magento shopping cart on your hosting account and how to use Magento encryption key to secure data
  • Magento featuresWhich are the main Magento features
  • Create a web store with MagentoLearn how to start creating your Magento web store – how to manage Magento categories, how to set special prices and promotions in Magento and how to process Magento orders
  • Magento productsHow to add new products in Magento – how to add images, how to manage product promotions and how toimport products in Magento, how to add quantity to Magento products
  • Magento themesHow to change Magento themes – where to find Magento themes and how to upload the new theme to your store
  • Magento CMSHow to use Magento CMS options to manage your shop pages
  • Magento SSLHow to set SSL certificate in Magento
  • Magento customer managerHow to use Magento customer manager
  • Magento modulesHow to add Magento modules with Magento Connect. How to configure Magento shipping modules andMagento payment modules
  • Magento issues and problems10 most common issues and problems with Magento
  • Magento newsletterHow to send newsletters with Magent
  • Magento widgetsHow to use Magento widgets
  • Magento SEOHow to optimize your shop for the Search engines (SEO)
  • Google Analytics for MagentoHow to configure Google Analytics for Magento
  • Move MagentoHow to transfer Magento to another location

magento-mvc-flowchart

 

Magento mvc flow chart image

 

 

Moodle was designed to help foster online learning communities. It has an active development and support group (very important for open-source projects) and has users in over 150 countries.

Moodle was built following social constructionist pedagogy as a virtual learning environment.

Moodle ?
verb – the process of lazily meandering through something; doing things as it occurs to you to do them; an enjoyable tinkering that often leads to insight and creativity.
If you’re writing a proposal, say it means: Modular Object-Oriented Dynamic Learning Environment
Either applies to both to the way Moodle was developed, and to the constructivist pedagogy that guided the original users group.

Anyone who uses Moodle is a Moodler.

What is Social Constructivism?

People actively construct new knowledge as they interact with their environment.
Everything you read, see, hear, feel, and touch is tested against your prior knowledge
Knowledge is strengthened if you can use it successfully in your wider environment.
You are not just a memory bank passively absorbing information, nor can knowledge be “transmitted” to you just by reading something or listening to someone.
Learning is particularly effective when constructing something for others to experience

Social Constructivism extends the above ideas into a social group constructing things for one another, collaboratively creating a small culture of shared artifacts with shared meanings.

Moodle is provided freely as Open Source software (under the GNU Public License).
Basically this means Moodle is copyrighted, but that you are allowed to copy, use and modify Moodle provided that you agree to:
provide the source to others;
not modify or remove the original license and copyrights,

and apply this same license to any derivative work.

Is there some system administrator in you?

Moodle runs without modification on Unix, Linux, Windows, Mac OS X, Netware and any other system that supports PHP 4.3.0+

Designed in a modular way – allows flexibility to add/remove functionality at many levels.
Upgrades easily – has an internal system to upgrade its own databases and repair itself over time.
Requires only one database, generally SQL, and can share it with other applications if necessary. (MySQL 4.1.16+).
Includes comprehensive database abstraction that supports many major brands of database.

Emphasis on security – forms are all checked, data validated, cookies encrypted etc.

Calendar

The Calendar allows you to enter events in various categories (User, Course and Site). You have the option to also show upcoming events, assignments etc., and recent activity in the course.

 

 

 

 

Best Practices: PHP Coding Style

1. Indenting
2. Control Structures {}
3. Comments:
/** * short description of function * * Optional more detailed description. * * @param $paramName – type – brief purpose * @param … * … * @return type and description */
4. Including Code: The simple solution is to replace all your include() and require() calls with corresponding include_once() and require_once().
5. PHP Tags: You should always use the full tags to enclose your code, not the abbreviated tags.
6. All DB config should be in one file.
7. Use Exceptions.
8. Use PHP Documenter
9. Write document before implementing the code.
10. Do not store important information in cookies
11. Nice OO, but much too much overhead in PHP:
The solution: Knowing where the limits are
• Do not implement every data structure as a class, arrays are useful, too
• Don’t split methods too much, think, which code you will really re-use
• You can always split the code of a method later, when needed
• Do you really need a that deep class tree?
12. Classes should be given descriptive names. NetFinger HTMLUploadError
13. Class Methods: getData() buildSomeWidget()
14. Constants should always be all-uppercase, with underscores to separate words. DB_DATASOURCENAME SERVICES_AMAZON_S3_LICENSEKEY
15. Class variable names should be prepended with the character ‘m’ & camelCased.
16. Method Argument Names: camelCased.
17. Function variable Names: use all lower case letters & use ‘_’ as the word separator.
18. References should be prepended with ‘r’.
19. Global variables should be prepended with a ‘g’.
20. Static variables may be prepended with ‘s’.
21. For PHP functions use all lower case letters with ‘_’ as the word delimiter.
22. Check every system call for an error return, unless you know you wish to ignore errors.
23. Always put the constant on the left hand side of an equality/inequality comparison. For example:
if ( 6 == $errorNum ) … 24. switch Formatting:
• The default case should always be present and trigger an error if it should not be reached, yet is reached.
• If you need to create variables put all the code in a block.
25. There should be only one statement per line unless the statements are very closely related.
26. Do not default the test for non-zero.
27. Do not check a Boolean value for equality with 1 (TRUE, YES, etc.); instead test for inequality with 0 (FALSE, NO, etc.).
28. Directory Documentation
Every directory should have a README file that covers:
• the purpose of the directory and what it contains
• a one line comment on each file. A comment can usually be extracted from the NAME attribute of the file header.
• cover build and install directions
• direct people to related resources:
29. Sometimes large blocks of code need to be commented out for testing. The easiest way to do this is with an if (0) block
30. Create a Source Code Control System Early and Not Often
31. Create a Bug Tracking System Early and Not Often

This article aims to serve for beginner PHP developers but those who are comfortable with PHP will also find this article useful. Basically, I’ll tell you the difference between some of PHP commonly used functions/features. By the end of this article you will have a clear difference among:

* include VS require
* include_once VS include
* require_once VS require
* echo VS print
* Single quote VS Double quote

Apparently all functions in each above point work in similar fashion. However, they are slightly different from other. Continue reading to explore the differences.

include VS require

Both are frequently used to include other files into our PHP code. Following are the differences between ‘include’ and ‘require’:

* ‘include’ throws a warning, if your specified file is not found. Rest of the code will be rendered.
* ‘require’ throws a fatal error, if your specified file is not found. Rest of the code will not be rendered.

include_once VS include AND require_once VS require

‘include_once’ and ‘require_once’ are same in nature. Here we will see the difference of ‘include_once’ against ‘include’. Following are the differences between ‘include’ and ‘include_once’:

* All includes for same file will be rendered, if you are using ‘include’.
* While all includes for same file will be rendered only once, if you are using ‘include_once’. This helps you to prevent an error, if same file included again.

Single quote VS Double quote

This might be very confusing for many developers to choose between single and double quote for writing string. There is a couple of difference between using single and double quote:

* Any variable or special character like \n \r etc under the single quote will not be rendered. It will be displayed as an string.
* Any variable or special character like \n \r etc under the double quote will be rendered properly.

PHP/FI 
Rasmus Lerdorf first started developing PHP/FI. He could not have imagined that his creation would eventually lead to the development of PHP as we know it today, which is being used by millions of people. The first version of “PHP/FI,” called Personal Homepage Tools/ Form Interpreter, was a collection of Perl scripts in 1995. 1 One of the basic features was a Perl-like language for handling form submissions, but it lacked many common useful language features, such as for loops.

PHP/FI 2 
A rewrite came with PHP/FI 2 in 1997, but at that time the development was almost solely handled by Rasmus. After its release in November of that year, Andi Gutmans and Zeev Suraski bumped into PHP/FI while looking for a language to develop an e-commerce solution as a university project. They discovered that PHP/FI was not quite as powerful as it seemed, and its language was lacking many common features. One of the most interesting aspects included the way while loops were implemented. The hand-crafted lexical scanner would go through the script and when it hit the while keyword it would remember its position in the file. At the end of the loop, the file pointer sought back to the saved position, and the whole loop was reread and re-executed.

PHP 3 
Zeev and Andi decided to completely rewrite the scripting language. They then teamed up with Rasmus to release PHP 3, and along also came a new name: PHP: Hypertext Preprocessor, to emphasize that PHP was a different product and not only suitable for personal use. Zeev and Andi had also designed and implemented a new extension API. This new API made it possible to easily support additional extensions for performing tasks such as accessing databases, spell checkers and other technologies, which attracted many developers who were not part of the “core” group to join and contribute to the PHP project. At the time of PHP 3’s release 3 in June 1998, the estimated PHP installed base consisted of about 50,000 domains. PHP 3 sparked the beginning of PHP’s real breakthrough, and was the first version to have an installed base of more than one million domains.

PHP 4 
PHP Programming In late 1998, Zeev and Andi looked back at their work in PHP 3 and felt they could have written the scripting language even better, so they started yet another rewrite. While PHP 3 still continuously parsed the scripts while executing them, PHP 4 came with a new paradigm of ?compile first, execute later.? PHP Programming compilation step does not compile PHP scripts into machine code; it instead compiles them into byte code, which is then executed by the Zend Engine (Zend stands for Ze ev & A nd i), the new heart of PHP 4. Because of this new way of executing scripts, the performance of PHP 4 was much better than that of PHP 3, with only a small amount of backward compatibility breakage 4 . Among other improvements was an improved extension API for better run-time performance, a web server abstraction layer allowing PHP 4 to run on most popular web servers, and lots more. PHP 4 was officially released on May 22, 2002, and today its installed base has surpassed 15 million domains. In PHP 3, the minor version number (the middle digit) was never used, and all versions were numbered as 3.0.x. This changed in PHP 4, and the minor version number was used to denote important changes in the language. The first important change came in PHP 4.1.0, 5 which introduced superglobals such as $_GET and $_POST . Superglobals can be accessed from within functions without having to use the global keyword. This feature was added in order to allow the register_globals INI option to be turned off. register_globals is a feature in PHP which automatically converts input variables like “?foo=bar” in http:// php.net/?foo=bar to a PHP variable called $foo . Because many people do not check input variables properly, many applications had security holes, which made it quite easy to circumvent security and authentication code. With the new superglobals in place, on April 22, 2002, PHP 4.2.0 was released with the register_globals turned off by default. PHP 4.3.0, the last significant PHP 4 version, was released on December 27, 2002. This version introduced the Command Line Interface (CLI), a revamped file and network I/O layer (called streams ), and a bundled GD library. Although most of those additions have no real effect on end users, the major version was bumped due to the major changes in PHP?s core.

PHP 5 

Soon after, the demand for more common object-oriented features increased immensely, and Andi came up with the idea of rewriting the objected-oriented part of the Zend Engine. Zeev and Andi wrote the ?Zend Engine II: Feature Overview and Design? document 6 and jumpstarted heated discussions about PHP?s future. Although the basic language has stayed the same, many features were added, dropped, and changed by the time PHP 5 matured. For example, namespaces and multiple inheritance, which were mentioned in the original document, never made it into PHP 5. Multiple inheritance was dropped in favor of interfaces, and namespaces were dropped completely. You can find a full list of new features in Chapter, ?What Is New in PHP 5?? PHP 5 is expected to maintain and even increase PHP?s leadership in the web development market. Not only does it revolutionizes PHP?s objectoriented support but it also contains many new features which make it the ultimate web development platform. The rewritten XML functionality in PHP 5 puts it on par with other web technologies in some areas and overtakes them in others, especially due to the new SimpleXML extension which makes it ridiculously easy to manipulate XML documents. In addition, the new SOAP, MySQLi, and variety of other extensions are significant milestones in PHP?s support for additional technologies.