PHP interview Question Part-2

Posted on:
tags: , , , , ,

  
PHP interview Question Part-2

1) What are the current versions of apache, PHP, and mysql?
    PHP -5.1.2
    Mysql -5.1
    Apache - 2
    Wamp -1.7.3

2) What is the difference between the functions UNLINK and UNSET?
    Unset destroy the variable declared earlier.
    Unlink is used to delete a file.

3) How can we increase the execution time of a PHP script?
   Set_time_limit is used to increase the execution time of a PHP script. The programmer can specify the time limit. When the requird time reached it indicates fatal error.

4) How can we get the browser properties using PHP?
    $_SERVER['HTTP_USER_AGENT'];

5) How can we send mail using JavaScript?
    function myfunction(form)
    {
    tdata=document.myform.tbox1.value;
    location=?mailto:dep7abc@leeds.ac.uk?
    subject=?+tdata+?/MYFORM?;
    return true;
    }

6) What is PHP?
    It is server side scripting, which help to create dynamic pages. When a user opens the page, the PHP command is processed in the server side and the result displayed on the user window.

7) What is htaccess?
   Htaccess is a configuration file that allows to change the configuration on pre-directory basis.

8) What is the difference between developing website using jsp and PHP
   JSP is not an opensource whereas PHP is opensource.
   JSP is compiler based and PHP is interpretor based scripting language.
   PHP in developing web page while JSP is mainly used for distributed system

9) What are magic quotes in PHP?
   Special characters like single double quote( “”) quote( ' ) amperson ( & ) are called as magic quotes.

10) How to prevent from hijacking in PHP?
    By setting the register_global to off inorder to prevent from entering malicious data.
    Set the error_reporting to E_All which initialize the variable before making use of them.
    Practice using mysql_escape_string()      

11) Explain about PHP cookies?
    Cookies are present in the desktop of the user. Everytime the user view the same page it is able to retrieve the data soon. PHP enable the programmer to create information and also to retrieve. This can be done using setcookie() function.

12) What is a session?
    A logical object developed by the PHP engine inorder to preserve the data for subsequent request is called session. The main purpose of the session is to store the temporary data allow multiple PHP pages to offer a complete functional transaction for the same visitor.

13) What is a persistent cookie?

    A cookie that is stored in a cookie file permanently is called persistent cookie. This is useful for long term information tracking.

14) What is the difference between copy of a file and Move_upload_file in file uploading?
    This function checks to check whether the designated file is a valid upload file. If it is a valid file then it could be moved to the specified designation.

15) How do you create subdomains using PHP?
       1) Restart httpd
       2) Edit httpd.conf

16) What is properties in PHP?
     Variables declared in the program is termed as properties. Variables are also referred as fields or arrribute. Variables are declared using the following keyword
     Private
     Protected
     Public

17) What is type hinting?
      Type hinting is the new function introduced in PHP 5.This function makes the parameter to be an object or array.

18) How to create a table?
     Tabel creation can be done using the following syntax
      include "tablecreation.php";
      $ sql = "CREATE TABLE fyi_links ("
      " id INTEGER NOT NULL"
      ", url VARCHAR(80) NOT NULL"
      ", notes VARCHAR(1024)"
      ", counts INTEGER"
      ", time TIMESTAMP DEFAULT sysdate()"
      ")";
      if (mysql_query($sql, $con)) {
      print("Table fyi_links created. ");
      } else {
      print("Table creation failed. ");
      }
      mysql_close($con);
      ?>

19) Explain about the data types in PHP?
     PHP has 6 scalar data types:-
     Integer
     Binary
     Float
     Boolean
     String
     Unicode

20) What about compound data types in PHP?
    PHP consist of two data types:-
    Array
    Object

21) Explain special data types in PHP?
    Data types that don’t fall into scalar and compound types is said to be special data types.
    Null
    Resource

22) How to change data types with casting?
     Casting is used to change the value type. It just changes the type of the value but the original value remains untouched.

23) What is loose typing in PHP?
     Languages such as java it is not possible to change the type of the variable they are said to be strongly typed whereas PHP are loosely typed meaning the type of the data can be changed in the later stage.

24) What is the difference between $message and $$message?
     $$message is reference variable whereas $message is just a fixed variable.

25) What are the different tables present in MySQL?
     Different tables that are present in MySQL are
     1.ISAM
     2.MyISAM
     3.Merge
     4.Heap
     5.INNODB


 ---------------------------------------------------------------------------------
Posted By Sundeep aka SunTechie

Sundeep is a Founder of Youth Talent Auzzar, a passionate blogger, a programmer, a developer, CISE and these days he is pursuing his graduation in Engineering with Computer Science dept.
Add Sundeep as a Friend on 


1 comment:

  1. Thanks for your grateful informations, this blogs will be really help for software engineering tutorial .

    ReplyDelete

< >