1. Who is the father of PHP ?
Rasmus Lerdorf is known as the father of PHP.
Php Interview Questions And Answers
2. What is the difference between $name and $$name?
$name is variable where as $$name is reference variable
like $name=sonia and $$name=singh so $sonia value is singh.
Php Interview Questions And Answers
3. How can we submit a form without a submit button?
Java script submit() function is used for submit form without submit button
on click call document.formname.submit().
Php Interview Questions And Answers
4. In how many ways we can retrieve the data in the result set of
MySQL using PHP?
We can do it by 4 Ways
1. mysql_fetch_row. , 2. mysql_fetch_array , 3. mysql_fetch_object
4. mysql_fetch_assoc
Php Interview Questions And Answers
5. What is the difference between mysql_fetch_object and
mysql_fetch_array?
mysql_fetch_object() is similar tomysql_fetch_array(), with one difference -
an object is returned, instead of an array. Indirectly, that means that
you can only access the data by the field names, and not by their
offsets (numbers are illegal property names).
Php Interview Questions And Answers
6. What are the differences between Get and post methods?
There are some defference between GET and POST method
1. GET Method have some limit like only 2Kb data able to send for request
But in POST method unlimited data can we send
2. when we use GET method requested data show in url but
Not in POST method so POST method is good for send sensetive request
Php Interview Questions And Answers
7. How can we extract string "pcds.co.in " from a string "http://info@pcds.co.in
using regular expression of PHP?
preg_match("/^http:\/\/.+@(.+)$/","http://info@pcds.co.in",$matches);
echo $matches[1];
Php Interview Questions And Answers
8. How can we create a database using PHP and MySQL?
We can create MySQL database with the use of
mysql_create_db("Database Name")
Php Interview Questions And Answers
9. What are the differences between require and include?
Both include and require used to include a file but when included file not found
Include send Warning where as Require send Fatal Error .
Php Interview Questions And Answers
10. Can we use include ("xyz.PHP") two times in a PHP page "index.PHP"?
Php Interview Questions And Answers
11. What are the different tables(Engine) present in MySQL, which one is default?
Php Interview Questions And Answers
12. What is use of header() function in php ?
The header() function sends a raw HTTP header to a client.We can use herder()
function for redirection of pages. It is important to notice that header() must
be called before any actual output is seen..
Php Interview Questions And Answers
13. How can I execute a PHP script using command line?
Just run the PHP CLI (Command Line Interface) program and
provide the PHP script file name as the command line argument.
Php Interview Questions And Answers
14. Suppose your Zend engine supports the mode <? ?> Then how can u
configure your PHP Zend engine to support <?PHP ?> mode ?
In php.ini file:
set
short_open_tag=on
to make PHP support
Php Interview Questions And Answers
15.Shopping cart online validation i.e. how can we configure Paypal, etc.?
Nothing more we have to do only redirect to the payPal url after
submit all information needed by paypal like amount,adresss etc.
Php Interview Questions And Answers
16. What is meant by nl2br()?
Inserts HTML line breaks (<BR />) before all newlines in a string.
Php Interview Questions And Answers
17. What is htaccess? Why do we use this and Where?
Php Interview Questions And Answers
Php Interview Questions And Answers
Php Interview Questions And Answers
Php Interview Questions And Answers
Php Interview Questions And Answers
22. What are the features and advantages of object-oriented programming?
One of the main advantages of OO programming is its ease of
modification; objects can easily be modified and added to a system there
by reducing maintenance costs. OO programming is also considered to be
better at modeling the real world than is procedural programming. It
allows for more complicated and flexible interactions. OO systems are
also easier for non-technical personnel to understand and easier for
them to participate in the maintenance and enhancement of a system
because it appeals to natural human cognition patterns.
For some systems, an OO approach can speed development time since many
objects are standard across systems and can be reused. Components that
manage dates, shipping, shopping carts, etc. can be purchased and easily
modified for a specific system.
Php Interview Questions And Answers
23. What are the differences between procedure-oriented languages and
object-oriented languages?
There are lot of difference between procedure language and object oriented like below
1>Procedure language easy for new developer but complex to understand whole software as compare to object oriented model
2>In Procedure language it is difficult to use design pattern mvc , Singleton pattern etc but in OOP you we able to develop design pattern
3>IN OOP language we able to ree use code like Inheritance ,polymorphism etc but this type of thing not available in procedure language on that our Fonda use COPY and PASTE .
Php Interview Questions And Answers
24. What is the use of friend function?
Sometimes a function is best shared among a number of different
classes. Such functions can be declared either as member functions of
one class or as global functions. In either case they can be set to be
friends of other classes, by using a friend specifier in the class that
is admitting them. Such functions can use all attributes of the class
which names them as a friend, as if they were themselves members of that
class.
A friend declaration is essentially a prototype for a member function,
but instead of requiring an implementation with the name of that class
attached by the double colon syntax, a global function or member
function of another class provides the match.
Php Interview Questions And Answers
25. What are the differences between public, private, protected,
static, transient, final and volatile?
Public: Public declared items can be accessed everywhere.
Protected: Protected limits access to inherited and parent
classes (and to the class that defines the item).
Private: Private limits visibility only to the class that defines
the item.
Static: A static variable exists only in a local function scope,
but it does not lose its value when program execution leaves this scope.
Final: Final keyword prevents child classes from overriding a
method by prefixing the definition with final. If the class itself is
being defined final then it cannot be extended.
transient: A transient variable is a variable that may not
be serialized.
volatile: a variable that might be concurrently modified by multiple
threads should be declared volatile. Variables declared to be volatile
will not be optimized by the compiler because their value can change at
any time.
Rasmus Lerdorf is known as the father of PHP.
Php Interview Questions And Answers
2. What is the difference between $name and $$name?
$name is variable where as $$name is reference variable
like $name=sonia and $$name=singh so $sonia value is singh.
Php Interview Questions And Answers
3. How can we submit a form without a submit button?
Java script submit() function is used for submit form without submit button
on click call document.formname.submit().
Php Interview Questions And Answers
4. In how many ways we can retrieve the data in the result set of
MySQL using PHP?
We can do it by 4 Ways
1. mysql_fetch_row. , 2. mysql_fetch_array , 3. mysql_fetch_object
4. mysql_fetch_assoc
Php Interview Questions And Answers
5. What is the difference between mysql_fetch_object and
mysql_fetch_array?
mysql_fetch_object() is similar tomysql_fetch_array(), with one difference -
an object is returned, instead of an array. Indirectly, that means that
you can only access the data by the field names, and not by their
offsets (numbers are illegal property names).
Php Interview Questions And Answers
6. What are the differences between Get and post methods?
There are some defference between GET and POST method
1. GET Method have some limit like only 2Kb data able to send for request
But in POST method unlimited data can we send
2. when we use GET method requested data show in url but
Not in POST method so POST method is good for send sensetive request
Php Interview Questions And Answers
7. How can we extract string "pcds.co.in " from a string "http://info@pcds.co.in
using regular expression of PHP?
preg_match("/^http:\/\/.+@(.+)$/","http://info@pcds.co.in",$matches);
echo $matches[1];
Php Interview Questions And Answers
8. How can we create a database using PHP and MySQL?
We can create MySQL database with the use of
mysql_create_db("Database Name")
Php Interview Questions And Answers
9. What are the differences between require and include?
Both include and require used to include a file but when included file not found
Include send Warning where as Require send Fatal Error .
Php Interview Questions And Answers
10. Can we use include ("xyz.PHP") two times in a PHP page "index.PHP"?
Yes we can use include("xyz.php") more than one time in any page. but it create a prob when xyz.php file contain some funtions declaration then error will come for already declared function in this file else not a prob like if you want to show same content two time in page then must incude it two time not a prob.
Php Interview Questions And Answers
11. What are the different tables(Engine) present in MySQL, which one is default?
Following tables (Storage Engine) we can create
1. MyISAM(The default storage engine IN MYSQL Each MyISAM table is stored on disk in three files. The files have names that begin with the table name and have an extension to indicate the file type. An .frm file stores the table format. The data file has an .MYD (MYData) extension. The index file has an .MYI (MYIndex) extension. )
2. InnoDB(InnoDB is a transaction-safe (ACID compliant) storage engine for MySQL that has commit, rollback, and crash-recovery capabilities to protect user data.)
3. Merge
4. Heap (MEMORY)(The MEMORY storage engine creates tables with contents that are stored in memory. Formerly, these were known as HEAP tables. MEMORY is the preferred term, although HEAP remains supported for backward compatibility. )
5. BDB (BerkeleyDB)(Sleepycat Software has provided MySQL with the Berkeley DB transactional storage engine. This storage engine typically is called BDB for short. BDB tables may have a greater chance of surviving crashes and are also capable of COMMIT and ROLLBACK operations on transactions)
6. EXAMPLE
7. FEDERATED (It is a storage engine that accesses data in tables of remote databases rather than in local tables. )
8. ARCHIVE (The ARCHIVE storage engine is used for storing large amounts of data without indexes in a very small footprint. )
9. CSV (The CSV storage engine stores data in text files using comma-separated values format.)
10. BLACKHOLE (The BLACKHOLE storage engine acts as a "black hole" that accepts data but throws it away and does not store it. Retrievals always return an empty result)
1. MyISAM(The default storage engine IN MYSQL Each MyISAM table is stored on disk in three files. The files have names that begin with the table name and have an extension to indicate the file type. An .frm file stores the table format. The data file has an .MYD (MYData) extension. The index file has an .MYI (MYIndex) extension. )
2. InnoDB(InnoDB is a transaction-safe (ACID compliant) storage engine for MySQL that has commit, rollback, and crash-recovery capabilities to protect user data.)
3. Merge
4. Heap (MEMORY)(The MEMORY storage engine creates tables with contents that are stored in memory. Formerly, these were known as HEAP tables. MEMORY is the preferred term, although HEAP remains supported for backward compatibility. )
5. BDB (BerkeleyDB)(Sleepycat Software has provided MySQL with the Berkeley DB transactional storage engine. This storage engine typically is called BDB for short. BDB tables may have a greater chance of surviving crashes and are also capable of COMMIT and ROLLBACK operations on transactions)
6. EXAMPLE
7. FEDERATED (It is a storage engine that accesses data in tables of remote databases rather than in local tables. )
8. ARCHIVE (The ARCHIVE storage engine is used for storing large amounts of data without indexes in a very small footprint. )
9. CSV (The CSV storage engine stores data in text files using comma-separated values format.)
10. BLACKHOLE (The BLACKHOLE storage engine acts as a "black hole" that accepts data but throws it away and does not store it. Retrievals always return an empty result)
Php Interview Questions And Answers
12. What is use of header() function in php ?
The header() function sends a raw HTTP header to a client.We can use herder()
function for redirection of pages. It is important to notice that header() must
be called before any actual output is seen..
Php Interview Questions And Answers
13. How can I execute a PHP script using command line?
Just run the PHP CLI (Command Line Interface) program and
provide the PHP script file name as the command line argument.
Php Interview Questions And Answers
14. Suppose your Zend engine supports the mode <? ?> Then how can u
configure your PHP Zend engine to support <?PHP ?> mode ?
In php.ini file:
set
short_open_tag=on
to make PHP support
Php Interview Questions And Answers
15.Shopping cart online validation i.e. how can we configure Paypal, etc.?
Nothing more we have to do only redirect to the payPal url after
submit all information needed by paypal like amount,adresss etc.
Php Interview Questions And Answers
16. What is meant by nl2br()?
Inserts HTML line breaks (<BR />) before all newlines in a string.
Php Interview Questions And Answers
17. What is htaccess? Why do we use this and Where?
.htaccess files are configuration files of Apache Server which provide
a way to make configuration changes on a per-directory basis. A file,
containing one or more configuration directives, is placed in a particular
document directory, and the directives apply to that directory, and all
subdirectories thereof.
a way to make configuration changes on a per-directory basis. A file,
containing one or more configuration directives, is placed in a particular
document directory, and the directives apply to that directory, and all
subdirectories thereof.
18. How we get IP address of client, previous reference page etc ?
By using $_SERVER['REMOTE_ADDR'],$_SERVER['HTTP_REFERER'] etc.
19. What are the reasons for selecting lamp (Linux, apache, MySQL,
PHP) instead of combination of other software programs, servers and
operating systems?
PHP) instead of combination of other software programs, servers and
operating systems?
All of those are open source resource. Security of Linux is very
very more than windows. Apache is a better server that IIS both in
functionality and security. MySQL is world most popular open source
database. PHP is more faster that asp or any other scripting language.
very more than windows. Apache is a better server that IIS both in
functionality and security. MySQL is world most popular open source
database. PHP is more faster that asp or any other scripting language.
20.How can we encrypt and decrypt a data present in a MySQL table
using MySQL?
using MySQL?
AES_ENCRYPT () and AES_DECRYPT ()
21. How can we encrypt the username and password using PHP?
The functions in this section perform encryption and decryption, and
compression and uncompression:
compression and uncompression:
encryption | decryption |
AES_ENCRYT() | AES_DECRYPT() |
ENCODE() | DECODE() |
DES_ENCRYPT() | DES_DECRYPT() |
ENCRYPT() | Not available |
MD5() | Not available |
OLD_PASSWORD() | Not available |
PASSWORD() | Not available |
SHA() or SHA1() | Not available |
Not available | UNCOMPRESSED_LENGTH() |
Php Interview Questions And Answers
22. What are the features and advantages of object-oriented programming?
One of the main advantages of OO programming is its ease of
modification; objects can easily be modified and added to a system there
by reducing maintenance costs. OO programming is also considered to be
better at modeling the real world than is procedural programming. It
allows for more complicated and flexible interactions. OO systems are
also easier for non-technical personnel to understand and easier for
them to participate in the maintenance and enhancement of a system
because it appeals to natural human cognition patterns.
For some systems, an OO approach can speed development time since many
objects are standard across systems and can be reused. Components that
manage dates, shipping, shopping carts, etc. can be purchased and easily
modified for a specific system.
Php Interview Questions And Answers
23. What are the differences between procedure-oriented languages and
object-oriented languages?
There are lot of difference between procedure language and object oriented like below
1>Procedure language easy for new developer but complex to understand whole software as compare to object oriented model
2>In Procedure language it is difficult to use design pattern mvc , Singleton pattern etc but in OOP you we able to develop design pattern
3>IN OOP language we able to ree use code like Inheritance ,polymorphism etc but this type of thing not available in procedure language on that our Fonda use COPY and PASTE .
Php Interview Questions And Answers
24. What is the use of friend function?
Sometimes a function is best shared among a number of different
classes. Such functions can be declared either as member functions of
one class or as global functions. In either case they can be set to be
friends of other classes, by using a friend specifier in the class that
is admitting them. Such functions can use all attributes of the class
which names them as a friend, as if they were themselves members of that
class.
A friend declaration is essentially a prototype for a member function,
but instead of requiring an implementation with the name of that class
attached by the double colon syntax, a global function or member
function of another class provides the match.
Php Interview Questions And Answers
25. What are the differences between public, private, protected,
static, transient, final and volatile?
Public: Public declared items can be accessed everywhere.
Protected: Protected limits access to inherited and parent
classes (and to the class that defines the item).
Private: Private limits visibility only to the class that defines
the item.
Static: A static variable exists only in a local function scope,
but it does not lose its value when program execution leaves this scope.
Final: Final keyword prevents child classes from overriding a
method by prefixing the definition with final. If the class itself is
being defined final then it cannot be extended.
transient: A transient variable is a variable that may not
be serialized.
volatile: a variable that might be concurrently modified by multiple
threads should be declared volatile. Variables declared to be volatile
will not be optimized by the compiler because their value can change at
any time.
Php Interview Questions And Answers
No comments:
Post a Comment
Note: only a member of this blog may post a comment.