Tuesday, October 27, 2009
File Concept
1.Read Local file
The easiest way to read the content of a disk file in PHP file_get_contents .
2.Reading Remove File
file_get_contents and file() both are support to reading data in URLs also either using HTTP or FTP.
3.Following functions are main things in PHP
fgets() => It is used to read the number of bytes from a file.
fopen() => It is used to open the file.
('r') => It is used to read the file
('w') => It is used to write a file.
Friday, October 16, 2009
Session in php
1.what is use of session?
A session is a logical object created by the PHP engine to allow you to preserve data across subsequent HTTP requests.
There is only one session object available to your PHP scripts at any time. Data saved to the session by a script can be retrieved by the same script or another script when requested from the same visitor.
Sessions are commonly used to store temporary data to allow multiple PHP pages to offer a complete functional transaction for the same visitor.
2. How to start ans destroy session in php?
1. session_start();
2. session _destroy();
Below example show u how to start and destroy:
3. PHP session variables:
Monday, October 5, 2009
PHP basic program
Special charcter
Use "\n" to add a line break
print "AA\nBB\nCC\nDD\nEE";
?>
output:
Use "\n" to add a line break
AA
BB
CC
DD
EE
PHP basic program
today i learn some basic prg.. these that things below
1.Concatenation of strings
";
print "I am Joe";
?>
"."I am Joe";
?>
both show result
Sunday, October 4, 2009
PHP OOPS Interview Questions & Answers
Object oriented programming language allows concepts such as modularity, encapsulation, polymorphism and inheritance. Objects are said to be the most important part of object oriented language. Concept revolves around making simulation programs around an object. Organize a program around its data (object)& set well define interface to that data. i.e. objects and a set of well defined interfaces to that data. OOP is the common abbreviation for Object-Oriented Programming. OOps have many properties such as DataHiding,Inheritence,Data Absraction,Data Encapsulation and many more.
2) Name some languages which have object oriented language and characteristics?
Some of the languages which have object oriented languages present in them are ABAP, ECMA Script, C++, Perl, LISP, C#, Tcl, VB, Ruby, Python, PHP, etc. Popularity of these languages has increased considerably as they can solve complex problems with ease.
3) Explain about UML?
UML or unified modeling language is regarded to implement complete specifications and features of object oriented language. Abstract design can be implemented in object oriented programming languages. It lacks implementation of polymorphism on message arguments which is a OOPs feature.
4) Explain the meaning of object in object oriented programming?
Languages which are called as object oriented almost implement everything in them as objects such as punctuations, characters, prototypes, classes, modules, blocks, etc. They were designed to facilitate and implement object oriented methods.
5) Explain about message passing in object oriented programming?
Message passing is a method by which an object sends data to another object or requests other object to invoke method. This is also known as interfacing. It acts like a messenger from one object to other object to convey specific instructions.
6) State about Java and its relation to Object oriented programming?
Java is widely used and its share is increasing considerably which is partly due to its close resemblance to object oriented languages such as C++. Code written in Java can be transported to many different platforms without changing it. It implements virtual machine.
7) What are the problems faced by the developer using object oriented programming language?
These are some of the problems faced by the developer using object oriented language they are: -
a) Object oriented uses design patterns which can be referred to as anything in general.
b) Repeatable solution to a problem can cause concern and disagreements and it is one of the major problems in software design.
8 ) State some of the advantages of object oriented programming?
Some of the advantages of object oriented programming are as follows: -
a) A clear modular structure can be obtained which can be used as a prototype and it will not reveal the mechanism behind the design. It does have a clear interface.
b) Ease of maintenance and modification to the existing objects can be done with ease.
c) A good framework is provided which facilitates in creating rich GUI applications.
9 ) Explain about inheritance in OOPS?
Objects in one class can acquire properties of the objects in other classes by way of inheritance. Reusability which is a major factor is provided in object oriented programming which adds features to a class without modifying it. New class can be obtained from a class which is already present.
10) Explain about the relationship between object oriented programming and databases?
Object oriented programming and relational database programming are almost similar in software engineering. RDBMS will not store objects directly and that’s where object oriented programming comes into play. Object relational mapping is one such solution.
11) Explain about a class in OOP?
In Object oriented programming usage of class often occurs. A class defines the characteristics of an object and its behaviors. This defines the nature and functioning of a specified object to which it is assigned. Code for a class should be encapsulated.
12) Explain the usage of encapsulation?
Encapsulation specifies the different classes which can use the members of an object. The main goal of encapsulation is to provide an interface to clients which decrease the dependency on those features and parts which are likely to change in future. This facilitates easy changes to the code and features.
13) Explain about abstraction?
Abstraction can also be achieved through composition. It solves a complex problem by defining only those classes which are relevant to the problem and not involving the whole complex code into play.
14) Explain what a method is?
A method will affect only a particular object to which it is specified. Methods are verbs meaning they define actions which a particular object will perform. It also defines various other characteristics of a particular object.
15) Name the different Creational patterns in OO design?
There are three patterns of design out of which Creational patterns play an important role the various patterns described underneath this are: -
a) Factory pattern
b) Single ton pattern
c) Prototype pattern
d) Abstract factory pattern
e) Builder pattern
16) Explain about realistic modeling?
As we live in a world of objects, it logically follows that the object oriented approach models the real world accurately. The object oriented approach allows you to identify entities as objects having attributes and behavior.
17) Explain about the analysis phase?
The anlaysis or the object oriented analysis phase considers the system as a solution to a problem in its environment or domain. Developer concentrates on obtaining as much information as possible about the problem. Critical requirements needs to be identified.
************************************************************************************************************
1) Explain the rationale behind Object Oriented concepts?
Object oriented concepts form the base of all modern programming languages. Understanding the basic concepts of object-orientation helps a developer to use various modern day programming languages, more effectively.
2) Explain about Object oriented programming?
Object oriented programming is one of the most popular methodologies in software development. It offers a powerful model for creating computer programs. It speeds the program development process, improves maintenance and enhances reusability of programs.
3) Explain what is an object?
An object is a combination of messages and data. Objects can receive and send messages and use messages to interact with each other. The messages contain information that is to be passed to the recipient object.
4) Explain the implementation phase with respect to OOP?
The design phase is followed by OOP, which is the implementation phase. OOP provides specifications for writing programs in a programming language. During the implementation phase, programming is done as per the requirements gathered during the analysis and design phases.
5) Explain about the Design Phase?
In the design phase, the developers of the system document their understanding of the system. Design generates the blue print of the system that is to be implemented. The first step in creating an object oriented design is the identification of classes and their relationships.
6) Explain about a class?
Class describes the nature of a particular thing. Structure and modularity is provided by a Class in object oriented programming environment. Characteristics of the class should be understandable by an ordinary non programmer and it should also convey the meaning of the problem statement to him. Class acts like a blue print.
7) Explain about instance in object oriented programming?
Every class and an object have an instance. Instance of a particular object is created at runtime. Values defined for a particular object define its State. Instance of an object explains the relation ship between different elements.
8 ) Explain about inheritance?
Inheritance revolves around the concept of inheriting knowledge and class attributes from the parent class. In general sense a sub class tries to acquire characteristics from a parent class and they can also have their own characteristics. Inheritance forms an important concept in object oriented programming.
9) Explain about multiple inheritance?
Inheritance involves inheriting characteristics from its parents also they can have their own characteristics. In multiple inheritance a class can have characteristics from multiple parents or classes. A sub class can have characteristics from multiple parents and still can have its own characteristics.
10) Explain about encapsulation?
Encapsulation passes the message without revealing the exact functional details of the class. It allows only the relevant information to the user without revealing the functional mechanism through which a particular class had functioned.
11) Explain about abstraction?
Abstraction simplifies a complex problem to a simpler problem by specifying and modeling the class to the relevant problem scenario. It simplifies the problem by giving the class its specific class of inheritance. Composition also helps in solving the problem to an extent.
12) Explain the mechanism of composition?
Composition helps to simplify a complex problem into an easier problem. It makes different classes and objects to interact with each other thus making the problem to be solved automatically. It interacts with the problem by making different classes and objects to send a message to each other.
13) Explain about polymorphism?
Polymorphism helps a sub class to behave like a parent class. When an object belonging to different data types respond to methods which have a same name, the only condition being that those methods should perform different function.
14) Explain about overriding polymorphism?
Overriding polymorphism is known to occur when a data type can perform different functions. For example an addition operator can perform different functions such as addition, float addition etc. Overriding polymorphism is generally used in complex projects where the use of a parameter is more.
15) Explain about object oriented databases?
Object oriented databases are very popular such as relational database management systems. Object oriented databases systems use specific structure through which they extract data and they combine the data for a specific output. These DBMS use object oriented languages to make the process easier.
16) Explain about parametric polymorphism?
Parametric polymorphism is supported by many object oriented languages and they are very important for object oriented techniques. In parametric polymorphism code is written without any specification for the type of data present. Hence it can be used any number of times.
17) What are all the languages which support OOP?
There are several programming languages which are implementing OOP because of its close proximity to solve real life problems. Languages such as Python, Ruby, Ruby on rails, Perl, PHP, Coldfusion, etc use OOP. Still many languages prefer to use DOM based languages due to the ease in coding.
var gaJsHost = ((”https:” == document.location.protocol) ? “https://ssl.” : “http://www.”);
document.write(unescape(”%3Cscript src=’” + gaJsHost + “google-analytics.com/ga.js’ type=’text/javascript’%3E%3C/script%3E”));
try {
var pageTracker = _gat._getTracker(”UA-1855756-5″);
pageTracker._trackPageview();
} catch(err) {}
Saturday, October 3, 2009
PHP interview questions
I attend first interview the following questions were asked by interviewer
1. What is the difference between mysql_fetch_object and mysql_fetch_array?
mysql_fetch_object : will return the results from database as objects. fields will be accessible like in objects i.e $result->name,$result->cust_name
mysql_fetch_array : will return the results from database as an array.The array will be in in associative as well as numeric manner. i.e $result['column_name'] or $result[0].here '0'indicates first column in table
2.difference between print and echo in php
One difference is that echo() can take multiple expressions:
phpPrint cannot take multiple expressions. That is the main distinct difference!
echo "The first", "the second";
?>
3.What is the difference between mysql_connect and mysql_pconnect ? Which one is good in terms of performance ?
mysql_connect opens a normal connections to mysql database.mysql_pconnect opens a persistant connection i.e. if there is any connection open in the script it will use that connection not making a new connection each time.at very high traffic enviornment mysql_connect provides better performance.
4.Types of Arays in php
In PHP, there are two types of Arrays. A Numerical or an Indexed Array and the other is an Associative Array.
In Numerical or an Indexed Array, the indexer of the array which is used to determine the position (also known as Key) of the stored data element is an integer which begins at zero. Consider this example:
| Position in Array | Name |
|---|---|
| 0 => | TCP |
| 1 => | IP |
| 2 => | DNS |
| 3 => | HTTP |
| 4 => | FTP |
| 5 => | SMTP |
In the left column, we are displaying the position of the name of the protocol that is on the right hand side. The position is an integer and is starting at zero. So, if you were to retrieve the name of the protocol which is at 4th position, then the Array will return 'FTP' and not 'HTTP'. In this way PHP uses integers as indexers or the key to store and determine the position of the data element in the Array. So how is it different from an Associative array?
In Associative array, the key or the indexer of the array which is used to refer to the data element is a string and not an integer. Consider this example:
| Abbreviation | Expanded Term |
|---|---|
| TCP => | Transmission Control Protocol |
| IP => | Internet Protocol |
| DNS => | Dynamic Naming System |
| HTTP => | Hyper Text Transfer Protocol |
| FTP => | File Transfer Protocol |
| SMTP => | Simple Mail Transfer Protocol |
In the above example as you can see, we have used strings and not integers to determine the position of the data elements. So, if we query the array for the data element which is stored at the position of 'SMTP' (our key for the data element), the array will return 'Simple Mail Transfer Protocol'.
Tuesday, July 7, 2009
Tags of PHP:
We mainly use 4 tags in PHP for any code and expressions.
They are
- Default tag or Standard tag
- Short tag
- Asp style tag
- Script tag
Default tag:
syntax:
Short tag:
syntax:
Asp tag:
syntax:
<% …........... %>
Script tag:
syntax:
Variable in PHP:
- Variables must be start with $ sign.
- Variables name first character must be alphabet.
- Variables in PHP follows alpha numeric concept.
- Variables are case sensitive.
- We can join one or more character or words as like as variable name through _(under score).
Ex:
int join_sal=100;
(or)
int joinSal=100;
- A space and special symbol not allow with variable name.
Variable must end with semicolon.
Ex:
int join_sal=100;
(or)
int joinSal=100;
Variable must end with semicolon.
Data type :
Data type is used to define while typing of values are specific in a variable.
There are six standard data types used in PHP.
- Integer (whole number, Ex : 54534)
- Float/Double (real number, Ex :1.677,24.786)
- String (any type of character which includes within single quotes. Ex : 'f',”regfd242”)
- Array (It can store one or more value in single memory space)
- Boolean (True or False statement)
- Object
In PHP we use two specific data types
- Null (undefined variables has null value .Ex : $x)
- Resource
In C,C++,JAVA we have restriction to define a variable with data type .But in PHP we are free to define variable without data type. PHP variable is also known as dynamic variable
Monday, July 6, 2009
PHP Introduction
Introduction of PHP:
While PHP was originally created by Rasmus Lerdorf in 1995 . Now the PHP is produced by The PHP Group.
What is PHP?
PHP is a scripting language. PHP is mainly used for web development.
Advantages of PHP:
- PHP is open source software.
- Processing is very fast compare to other softwares and other technology.
- PHP supports the cross platform.
- PHP is also run in low configuration.
- PHP also support the Oops concept.
- PHP requires minimum softwares only.
Sunday, July 5, 2009
Tell about yourself

This is most frequent and most important interview question. It is the gateway for company.
The most common mistake of freshers is telling about family details ,native place,their socializing capabilities and other junks.
After title bit googling.I thought these are the points I have to follow.
- Keep your focus on job profile.
- Complete answer within one to two minute.
- Stay on professional and justify yourself for job profile.
- Eagle view on education background.
I am practicing these things if you have suggestion comment me.
Saturday, July 4, 2009
Three tier architecture and human similarity
Today I went to PHP class. It is very interesting one. My class facility explain about three-tier architecture. He explain me in different way. He related three tier with human being. Here you can find three tier diagram

Hmmmm and his comparison goes here
Human body and Interface :
He related body with interface. Body doing the work which are visible to us. In web architecture. We are using browser for interaction and see results. This layer is called presentation layer.
Brain and PHP :
He related brain with logical layer. We use the brain to take decision likewise PHP is used to make decision in web architecture .
Memory and Database :
He related memory with database. Memory store the information similarly database stores the web or user data.