PHP Interview Question And Answare | PHP Interview Question And Answare for Fresher | Set 01

1.What's PHP ?
 Ans: The PHP Hypertext Preprocessor is a programming language that allows web developers to create dynamic content that interacts with databases. PHP is basically used for developing web based software applications.

2.What Is a Session?
 Ans: 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.

3.What is meant by PEAR in php?
 Ans: PEAR is the next revolution in PHP. This repository is bringing higher level programming to PHP. PEAR is a framework and distribution system for reusable PHP components. It eases installation by bringing an automated wizard, and packing the strength and experience of PHP users into a nicely organised OOP library. PEAR also provides a command-line interface that can be used to automatically install "package

4.What is the difference between $message and $$message?
 Ans: $message is a simple variable whereas $$message is a reference variable.
         Example:
          $user = 'bob'is equivalent to

          $holder = 'user';
          $$holder = 'bob';

5.What are the differences between DROP a table and TRUNCATE a table?
 Ans: DROP TABLE table_name - This will delete the table and its data.

          TRUNCATE TABLE table_name - This will delete the data of the table, but not the table definition.

6.What are the differences between mysql_fetch_array(), mysql_fetch_object(), mysql_fetch_row()?
 Ans: mysql_fetch_array – Fetch a result row as an associative array and a numeric array.
          mysql_fetch_object – Returns an object with properties that correspond to the fetched row and moves the internal data pointer ahead. Returns an object with properties that correspond to the fetched row, or FALSE if there are no more rows
          mysql_fetch_row() – Fetches one row of data from the result associated with the specified result identifier. The row is returned as an array. Each result column is stored in an array offset, starting at offset 0

7.How do you call a constructor for a parent class?
 Ans: parent::constructor($value)

8.WHAT ARE THE DIFFERENT TYPES OF ERRORS IN PHP?
 Ans: 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.

9.What’s the special meaning of __sleep and __wakeup?
 Ans:  __sleep returns the array of all the variables than need to be saved, while __wakeup retrieves them.

10.What are the different functions in sorting an array?
 Ans: Sorting functions in PHP:
            asort()
            arsort()
            ksort()krsort()
            uksort()
            sort()
            natsort()


Previous Next


:: Click the links below for similar type Questions and answers ::

Set 01 | Set 02  | Set 03  | Set 04  | Set 05  | Set 06  | Set 07  | Set 08  | Set 09 

0 comments:

Post a Comment

 
Design by Wordpress Theme | Bloggerized by Free Blogger Templates | coupon codes