:: Home     :: MS Dynamics CRM     :: .Net 1.1     :: .Net 2.0     :: Sharepoint Portal     :: Ajax

  login:         
  passwords:  

Interview Questions and answers for PHP [Part 5]

The General Php Interview Questions consists the most frequently asked questions in Php. This list of 100+ questions guage your familiarity with the Php platform. The q&a have been collected over a period of time from various blogs, forums and other similar Php sites

5.Php interview Questions Part[5]

    5.1 How many ways I can redirect a PHP page?
   5.2 Steps for the payment gateway processing?
   5.3 What is the default session time in php and how can I change it?
   5.4 How many ways we can give the output to a browser?
   Please give a regular expression (preferably Perl/PREG style), which can be used to identify the URL from within a HTML link tag.
   5.6 What are the different ways to login to a remote server? Explain the means, advantages and disadvantages?
    5.7 How can we change the name of a column of a table?
   5.8 How can increase the performance of MySQL select query?
   5.9 What’s the difference between accessing a class method via -> and via ::?
   5.10 What are the difference between abstract class and interface?
   5.11 How can I make a script that can be bilingual (supports English, German)?
   5.12 What is the maximum size of a file that can be uploaded using PHP and how can we change this?
   5.13 How can we get second of the current time using date function?
   5.14 What are the features and advantages of OBJECT ORIENTED PROGRAMMING?
   5.15 What are the reasons for selecting LAMP (Linux, Apache, MySQL, Php) instead of combination of other software programs, servers and operating systems?
    5.16 What are the current versions of Apache, PHP, and MySQL?
   5.17 How can we destroy the cookie?
   5.18 How many ways can we get the value of current session id?
   5.19 How can we submit from without a submit button?
   5.20 How to reset/destroy a cookie

5.1 How many ways I can redirect a PHP page?

Here are the possible ways of php page redirection.
1. Using Java script:
'; echo 'window.location.href="'.$filename.'";'; echo ''; echo ''; echo ''; echo ''; } } redirect('http://maosjb.com'); ?>
2. Using php function: header("Location:http://maosjb.com ");


5.2 Steps for the payment gateway processing?

An online payment gateway is the interface between your merchant account and your Web site. The online payment gateway allows you to immediately verify credit card transactions and authorize funds on a customer's credit card directly from your Web site. It then passes the transaction off to your merchant bank for processing, commonly referred to as transaction batching


5.3 What is the default session time in php and how can I change it?

The default session time in php is until closing of browser


5.4 How many ways we can give the output to a browser?

HTML output
PHP, ASP, JSP, Servlet Function
Script Language output Function
Different Type of embedded Package to output to a browser


5.5 Please give a regular expression (preferably Perl/PREG style), which can be used to identify the URL from within a HTML link tag

Try this: /href="([^"]*)"/i


5.6 What are the different ways to login to a remote server? Explain the means, advantages and disadvantages?

There is at least 3 ways to logon to a remote server:
Use ssh or telnet if you concern with security
You can also use rlogin to logon to a remote server.


5.7 How can we change the name of a column of a table?

MySQL query to rename table: RENAME TABLE tbl_name TO new_tbl_name or, ALTER TABLE tableName CHANGE OldName newName.


5.8 How can increase the performance of MySQL select query?

We can use LIMIT to stop MySql for further search in table after we have received our required no. of records, also we can use LEFT JOIN or RIGHT JOIN instead of full join in cases we have related data in two or more tables. What type of inheritance that php supports? In PHP an extended class is always dependent on a single base class, that is, multiple inheritance is not supported. Classes are extended using the keyword 'extends'


5.9 What’s the difference between accessing a class method via -> and via ::?

:: is allowed to access methods that can perform static operations, i.e. those, which do not require object initialization.


5.10 What are the difference between abstract class and interface?

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.


5.11 How can I make a script that can be bilingual (supports English, German)?

You can change charset variable in above line in the script to support bilanguage.


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

You can change maximum size of a file set upload_max_filesize variable in php.ini file


5.13How can we get second of the current time using date function?

h$second = date("s");


5.14 What are the features and advantages of OBJECT ORIENTED PROGRAMMING?

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.


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

All of those are open source resource. Security of linux is very 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.


5.16 What are the current versions of Apache, PHP, and MySQL?

PHP: PHP 5.1.2
MySQL: MySQL 5.1
Apache: Apache 2.1


5.17 How can we destroy the cookie?

Set the cookie with a past expiration time.


5.18 How many ways can we get the value of current session id?

session_id() returns the session id for the current session.


5.19 How can we submit from without a submit button?

Trigger the JavaScript code on any event ( like onSelect of drop down list box, onfocus, etc ) document.myform.submit(); This will submit the form.


5.20How to reset/destroy a cookie

Reset a cookie by specifying expire time in the past:
Example: setcookie('Test',$i,time()-3600); // already expired time
Reset a cookie by specifying its name only
Example: setcookie('Test');

Copyright 2007, Megasolutions Ltd