• +91 9723535972
  • info@interviewmaterial.com

PHP Interview Questions and Answers

PHP Interview Questions and Answers

Question - 101 : - How many ways can we get the value of current session id?

Answer - 101 : - session_id() returns the session id for the current session.

Question - 102 : - How can we destroy the cookie?

Answer - 102 : - Set the cookie with a past expiration time.

Question - 103 : - What are the current versions of Apache, PHP, and MySQL?

Answer - 103 : - PHP: PHP 5.1.2 MySQL: MySQL 5.1 Apache: Apache 2.1

Question - 104 : - What are the reasons for selecting LAMP (Linux, Apache, MySQL, Php) instead of combination of other software programs, servers and operating systems?

Answer - 104 : - All of those are open source resource. Security of  Linux is very more than windows. Apache is a better server that IIS both in functionality and security. Mysql is world most popular open source database. Php is more faster that asp or any other scripting language.

Question - 105 : - What are the features and advantages of OBJECT ORIENTED PROGRAMMING?

Answer - 105 : - One of the main advantages of OO programming is its ease of modification; objects can easily be modified and added to a system there by reducing maintenance costs. OO programming is also considered to be better at modeling the real world than is procedural programming. It allows for more complicated and flexible interactions. OO systems are also easier for non-technical personnel to understand and easier for them to participate in the maintenance and enhancement of a system because it appeals to natural human cognition patterns. For some systems, an OO approach can speed development time since many objects are standard across systems and can be reused. Components that manage dates, shipping, shopping carts, etc. can be purchased and easily modified for a specific system.

Question - 106 : - How can we get second of the current time using date function?

Answer - 106 : - $second = date("s");

Question - 107 : - What is the use of friend function?

Answer - 107 : - Friend functions Sometimes a function is best shared among a number of different classes. Such functions can be declared either as member functions of one class or as global functions. In either case they can be set to be friends of other classes, by using a friend specifier in the class that is admitting them. Such functions can use all attributes of the class which names them as a friend, as if they were themselves members of that class. A friend declaration is essentially a prototype for a member function, but instead of requiring an implementation with the name of that class attached by the double colon syntax, a global function or member function of another class provides the match. class mylinkage { private: mylinkage * prev; mylinkage * next; protected: friend void set_prev(mylinkage* L, mylinkage* N); void set_next(mylinkage* L); public: mylinkage * succ(); mylinkage * pred(); mylinkage(); }; void mylinkage::set_next(mylinkage* L) { next = L; } void set_prev(mylinkage * L, mylinkage * N ) { N->prev = L; } Friends in other classes It is possible to specify a member function of another class as a friend as follows: class C { friend int B::f1(); }; class B { int f1(); }; It is also possible to specify all the functions in another class as friends, by specifying the entire class as a friend. class A { friend class B; }; Friend functions allow binary operators to be defined which combine private data in a pair of objects. This is particularly powerful when using the operator overloading features of C++. We will return to it when we look at overloading.

Question - 108 : - What is the maximum size of a file that can be uploaded using PHP and how can we change this?

Answer - 108 : - You can change maximum size of a file set upload_max_filesize variable in php.ini file

Question - 109 : - How can I make a script that can be bilingual (supports English, German)?

Answer - 109 : - You can change char set variable in above line in the script to support bi language.

Question - 110 : - What are the difference between abstract class and interface?

Answer - 110 : - Abstract class: abstract classes are the class where one or more methods are abstract but not necessarily all method has to be abstract. Abstract methods are the methods, which are declare in its class but not define. The definition of those methods must be in its extending class. Interface: Interfaces are one type of class where all the methods are abstract. That means all the methods only declared but not defined. All the methods must be define by its implemented class.


NCERT Solutions

 

Share your email for latest updates

Name:
Email:

Our partners