Wednesday, January 28, 2009

PHP Interview Questions

PHP Interview Questions

1) Explain about PHP?
Personal home page language is used to create dynamic and interactive websites which are very efficient in delivering client needs from the server side. This language is widely used. It is used on various operating systems with Apache modules. This can be directly embedded into HTML code.

2) Explain about the installation of PHP on UNIX systems?
PHP can be installed on UNIX in many different ways there are pre defined packages available which can ease the process. Initially it can be controlled by the command line options. Help can be obtained from./configure help command. After installing PHP modules or executables can be configures and make command should help you in the process.

3) How to enable parsing?
Parsing is an important concept if you want to run your code appropriately and timely. PHP parses all the code present between the opening and closing tags, it ignores everything present out of the closing and opening tags. This tags allow PHP to be embedded between many documents.

4) What are the different opening and closing tags available in PHP?
There are four different types of tags available in PHP they are
*
*

* PHP short tags
* ASP style tags.
Generally the first two tags are widely used because they are portable.

5) Explain about array uintersect()?
This function is very useful in PHP. This function compares array values in a user defined function and it returns the array. If assoc() is added to the function it compares array keys. This function can also be defined as array uintersect uassoc().

6) Explain about converting an object?
When an object is converted into an object the stance of the object is not modified. A new instance of the class is created if a value of different type if converted into an object. Incase the value is null at the time of conversion the new instance will be empty.

7) Explain about resource?
Resource holds reference to an external resource and it is a special variable. These are created and used by specially defined functions. Resource holds defined and special handlers for opening files. Converting to a resource makes no sense at all.

8) Explain about null?
Null represents a variable with no value inside. There doesn’t exist any value for type Null. Null is defined to be null if and only if it is assigned a constant null, there is no value set, it is set to be unset(). This is the case insensitive keyword. There are also two functions they are is_null and unset().

9) Explain about mixed and callback functions?
Mixed function indicates that the function may contain multiple types but it doesn’t form a necessary condition. Functions like call_user_func() or usort() accept user defined functions as parameter. These functions are not only simple but also object methods which includes static methods.

10) Explain about PHP looping?
Looping statements are used in PHP to execute the code for a developer defined number of times. PHP has these following looping statements they are while, do while, for and for each. Foreach is used to loop a block of code in each element in an array.

11) Explain about Booleans in PHP?
A Boolean type states a truth value whether it is true or false. These statements are case insensitive. An operator returns a Boolean value and this value is passed onto the control structure which executes the statement. If an argument is required it is automatically converted.

12) Explain about Type juggling?
PHP uses Type juggling similar to the way Perl uses. Variable is defined in the context in which it is used. It doesn’t require any explicit definition for a function to perform its duties. For example if a string value is assigned to a variable it is defined as string.

13) Explain about the casts allowed in PHP?
Type casting acts and functions similarly as it performs in C. The casts allowed are Integer, Boolean, float and double, string, binary, array and object. Casting and support was added in PHP 5.2.1. A variable can be enclosed in double quotes instead of casting it to a string.

14) How to change the principal password?
Principal password can be changed by using kadm5_chpass_principal command. If you also want to specify the new password for effecting a change to the principal password it should be as
Bool kadm5_chpass_principal (resource $handle, string $principal, string password). This changes the password to password.

15) Explain about the advantages of using PHP?
There are many advantages of PHP they are
1) Easy and fast creation of dynamic web pages and a developer can also embed these dynamic functions into HTML.
2) A huge community resource which has a ton of information before you.
3) Connectivity ability lets you to connect to different interfaces and predefined libraries.
4) Execution is very fast because it uses less system resources, etc.

16) Explain about the connective abilities of the PHP?
A huge advantage for PHP is its connective ability. It uses huge number of extensions to interface with huge pool of libraries such as XML, graphics and encryption. Programmers can create their own extensions and compiling them. They can load their own programs by using the dynamic loading mechanism.

17) How can MYSQL functions be available with PHP?
MYSQL is not available as a default feature it must be created by the user. You can use --with-mysql=DIR function to make available SQL on your system. Compiling PHP functions with MYSQL will increase the support and functioning of the language. MYSQL should be installed where there are extensions of PHP

No comments: