19 May 2012

PHP Interview Questions - II

I am trying to assign a variable the value of 0123, but it keeps coming up with a different number, what’s the problem?

            PHP Interpreter treats numbers beginning with 0 as octal.


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
1. MyISAM
2. Heap
3. Merge
4. INNO DB
5. ISAM
MyISAM is the default storage engine as of MySQL 3.23. When you fire the above create query MySQL will create a MyISAM table.

What is the functionality of the functions STRSTR() and STRISTR()?

string strstr ( string haystack, string needle ) returns part of haystack string from the first occurrence of needle to the end of haystack. This function is case-sensitive. stristr() is idential to strstr() except that it is case insensitive. 

When are you supposed to use endif to end the conditional statement?

               When the original if was followed by : and then the code block without braces.

How can we send mail using JavaScript?

              No. There is no way to send emails directly using JavaScript. 



What is the purpose of the following files having extensions: frm, myd, and myi? What these files contain?

             In MySQL, the default table type is MyISAM.
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.

The '.frm' file stores the table definition.
The data file has a '.MYD' (MYData) extension.
The index file has a '.MYI' (MYIndex) extension,

Are objects passed by value or by reference?

           Everything is passed by value.

WHAT ARE THE DIFFERENT TYPES OF ERRORS IN PHP?

           Here are three basic types of runtime errors in PHP:

1. Notices: These are trivial, non-critical errors that PHP encounters while executing a script - for example, accessing a variable that has not yet been defined. By default, such errors are not displayed to the user at all - although you can change this default behavior.

2. Warnings: These are more serious errors - for example, attempting to include() a file which does not exist. By default, these errors are displayed to the user, but they do not result in script termination.

3. Fatal errors: These are critical errors - for example, instantiating an object of a non-existent class, or calling a non-existent function. These errors cause the immediate termination of the script, and PHP's default behavior is to display them to the user when they take place.

Internally, these variations are represented by twelve different error types


Can we use include ("abc.php") two times in a php page "makeit.php"?

            Yes. 

How can we destroy the session, how can we unset the variable of a session?
 
session_unregister() - Unregister a global variable from the current session
session_unset() - Free all session variables 










 


No comments:

Post a Comment