Php+mysql Interview Questions

Who Is The Father Of Php And Explain The Changes In Php Versions?
Rasmus Lerdorf is known as the father of PHP. PHP/FI 2.0 is an early and no longer supported version of PHP. PHP 3 is the successor to PHP/FI 2.0 and is a lot nicer. PHP 4 is the current generation of PHP, which uses the Zend engine under the hood. PHP 5 uses Zend engine 2 which, among other things, offers many additional OOP features

How Can We Submit A Form Without A Submit Button?
The main idea behind this is to use Java script submit() function in order to submit the form without explicitly clicking any submit button. You can attach the document.formname.submit() method to onclick, onchange events of different inputs and perform the form submission. you can even built a timer function where you can automatically submit the form after xx seconds once the loading is done (can be seen in online test sites).

In How Many Ways We Can Retrieve The Data In The Result Set Of Mysql Using Php?
You can do it by 4 Ways

mysql_fetch_row.
mysql_fetch_array
mysql_fetch_object
mysql_fetch_assoc

What Is The Difference Between Mysql_fetch_object And Mysql_fetch_array?
mysql_fetch_object() is similar to mysql_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).

What Is The Difference Between $message And $$message?
It is a classic example of PHP’s variable variables. take the following example.$message = “Mizan”;$$message = “is a moderator of PHPXperts.”;$message is a simple PHP variable that we are used to. But the $$message is not a very familiar face. It creates a variable name $mizan with the value “is a moderator of PHPXperts.” assigned. break it like this${$message} => $mizanSometimes it is convenient to be able to have variable variable names. That is, a variable name which can be set and used dynamically.

How Can We Create A Database Using Php And Mysql?
We can create MySQL database with the use of mysql_create_db(“Database Name”)

Can We Use Include (“abc.php”) Two Times In A Php Page “makeit.php”?
Yes we can use include() more than one time in any page though it is not a very good practice.

What Are The Different Tables Present In Mysql, Which Type Of Table Is Generated When We Are Creating A Table In The Following Syntax:
Create Table Employee (eno Int(2),ename Varchar(10)) ?
Total 5 types of tables we can create

MyISAM
Heap
Merge
INNO DB
ISAM
MyISAM is the default storage engine as of MySQL 3.23 and as a result if we do not specify the table name explicitly it will be assigned to the default engine.

Functions In Imap, Pop3 And Ldap?
You can find these specific information in PHP Manual.

How Can I Execute A Php Script Using Command Line?
As of version 4.3.0, PHP supports a new SAPI type (Server Application Programming Interface) named CLI which means Command Line Interface. Just run the PHP CLI (Command Line Interface) program and provide the PHP script file name as the command line argument. For example, “php myScript.php”, assuming “php” is the command to invoke the CLI program.

Be aware that if your PHP script was written for the Web CGI interface, it may not execute properly in command line environment.

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

What Is Meant By Nl2br()?
Inserts HTML line breaks (<BR/>) before all newlines in a string string nl2br (string); Returns string with ” inserted before all newlines. For example: echo nl2br(“god bless\n you”) will output “god bless <br/>you” to your browser.

What Are The Reasons For Selecting Lamp (linux, Apache, Mysql, 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.

How Can We Encrypt And Decrypt A Data Present In A Mysql Table Using Mysql?
AES_ENCRYPT () and AES_DECRYPT ()

What Are The Features And Advantages Of Object-oriented Programming?
One of the main advantages of programming is its ease of modification; objects can easily be modified and added to a system there by reducing maintenance costs.

programming is also considered to be better at modeling the real world than is procedural programming. It allows for more complicated and flexible interactions.

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 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

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.

What Is The Functionality Of The Function Htmlentities?
Convert all applicable characters to HTML entities This function is identical to htmlspecialchars() in all ways, except with htmlentities(), all characters which have HTML character entity equivalents are translated into these entities.

How Can We Get Second Of The Current Time Using Date Function?
$second = date(“s”);

What Is The Difference Between The Functions Unlink And Unset?
unlink() deletes the given file from the file system.

unset() makes a variable undefined.

How Can We Register The Variables Into A Session?
$_SESSION[’name’] = “Mizan”;

Leave a Reply