“PHP” Interview Questions

-: “PHP” Interview Questions :-

1. Who is the father of PHP ?
Ans:The php was invented by Rasmus Lerdorf.

2.What is $name ?
Ans:Basically the variable are describe in php like that way.It is a variable.

3.What is $$name?
Ans:It act like refarance variable or value of a particular variable.

4.What are the method available in form submitting?
Ans:From submittingMethods are 1.get, 2.post.

5.How can we get the browser properties using PHP?
Ans :to acess browser property we can write the code ssuch like that

echo $_SERVER[‘HTTP_USER_AGENT’].”\n\n”;

6.What Is a Session?
Ans:It is basically used to store temporary Data for a time scape .It allow different php page to offer complite functional pag eoperation.

SEE MORE: “C” Interview Question

7.How can we register the variables into a session?
Ans: session can be coded like that way

8.How many ways we can pass the variable through the navigation between the pages?
Ans:there are three type of way to pass the variable throughh the navigation.they are
1.variable as a cookie
2.ariable as part of the URL
3.Register the variable into the session.

9.How can we know the total number of elements of Array?
Ans:There are two mathod to find total number of element of arry sizeof($array_var)
count($array_var).it is kind of c++ syntex.

10.How can we create a database using php?
Ans: There is a code to create db in my sql using php code .The mathod is mysql_create_db();

11.What are encryption functions in PHP?
ANS: two encryptionfunction in pHP and they are 1.MD 5 and 2.CRYPT.

12.How to store the uploaded file to the final location?
Ans:using move_uploaded_file( string filename, string destination) method.

SEE MORE: “C #” Interview Question

13.Explain mysql_error().
Ans:This error msg help us to understood what is wrong in the quarry.

14. What is Constructors
Ans:IN PHP we can easily declier the constructor method form a class.It can call each newly created object.it help to initialization That the object needs.

Ans:To order for a shut down sequence or to destroy the object that destructor method are call.it is similier type method used in c++ OOPL.

16.Explain the visibility of the property or method.?
Ans:when in a code there is using of private ,public and protected keyword as a prefixing the declaration.

17.what is public keyword ?
ans:By using this keyword prifixing the calss member can be accessed by anywhere.

18.What is mean by require?
Ans:Bsicaly this key word is used to include a file if include warninig it send error calleed fatal error.

19.what is include means ?
Ans:it alos used to include a file when there is no found of include file it send a warning to requier.

20.What is use of header() function in php ?
Ans:It is a function oh http.It is raw HTTP hader .It can be used to redirection of a page.

21.List out the predefined classes in PHP?
Ans: there are predefined calsses and they are :
5.php_user_filter.There are basically this 5 type of predefined classes found.

22.What type of inheritance that PHP supports?
Ans:It is a class whaich is dependent on a singel baseclass. multiple inheritance is not possiable.keyword is used “extended “.It is called extended class.

23.How can we encrypt the username and password using php?
Ans:we can use Mysql>SET PASSWORD=PASSWORD(“Password”); that code for encryption.

24.How do you define a constant?
Ans:using the define method it can be describe a constractor.just written it define() directive, exm: define(“constractor”,10);

25.How do you pass a variable by value in PHP?
Ans:$a = &$b; just put a ampersand before variable it can be easly pass a variable by value.

26.What does a special set of tags <?= and ?> do in PHP?
Ans:It is ued to produce otput.it show directly the output in a browser.

27.How do you call a constructor for a parent class?
Ans:Using parent::constructor($value) that method.

SEE MORE:  “.NET” Interview Questions”

28.What’s the special meaning of __sleep ?
Ans:before saving variaable it return the array of the variable.

29.what is __wakeup?
Ans:it is basically a method which retrive the return arry of the variable.

30.How many ways can we get the value of current session id?
Ans:Using session_id() method it can retuen the value of current session Id.
31.How can we get second of the current time using date function?
Ans:the code is :
$second = date(“s”);

32.What are the Formatting and Printing Strings available in PHP?
Ans : there 4 type of string available in PHP.and they are
1.printf() 2.sprintf() formatted string variable,3.fprintf() to print a formated string, 4.number_format() used to fromats Number of string.