Zensar Technologies PHP Interview Questions

When do sessions end?

Sessions automatically end when the PHP script finishes executing but can be manually ended using the session_write_close().

What is the difference between session_unregister() and session_unset()?

The session_unregister() function unregister a global variable from the current session and the session_unset() function frees all session variables.

What does $GLOBALS mean?

$GLOBALS is associative array including references to all variables which are currently defined in the global scope of the script.

What does $_SERVER mean?

$_SERVER is an array including information created by the web server such as paths, headers, and script locations.
Zensar Technologies PHP Most Frequently Asked Latest Interview Questions Answers
Zensar Technologies PHP Most Frequently Asked Latest Interview Questions Answers

What does $_FILES means?

$_FILES is an associative array composed of items sent to the current script via the HTTP POST method.

What is the difference between $_FILES['userfile']['name'] and $_FILES['userfile']['tmp_name']?

$_FILES['userfile']['name'] represents the original name of the file on the client machine,

$_FILES['userfile']['tmp_name'] represents the temporary filename of the file stored on the server.

How can we get the error when there is a problem to upload a file?

$_FILES['userfile']['error'] contains the error code associated with the uploaded file.

How can we change the maximum size of the files to be uploaded?

We can change the maximum size of files to be uploaded by changing upload_max_filesize in php.ini.

What does $_ENV mean?

$_ENV is an associative array of variables sent to the current PHP script via the environment method.

How can we determine whether a PHP variable is an instantiated object of a certain class?

To be able to verify whether a PHP variable is an instantiated object of a certain class we use instanceof.

What is the goto statement useful for?

The goto statement can be placed to enable jumping inside the PHP program. The target is pointed by a label followed by a colon, and the instruction is specified as a goto statement followed by the desired target label.

what is the difference between Exception::getMessage and Exception:: getLine?

Exception::getMessage lets us getting the Exception message and Exception::getLine lets us getting the line in which the exception occurred.

What does the expression Exception::__toString means?

Exception::__toString gives the String representation of the exception.

How is it possible to parse a configuration file?

The function parse_ini_file() enables us to load in the ini file specified in filename and returns the settings in it in an associative array.

Check If A Variable Is An Integer In Javascript ?
var myValue =9.8;
if(parseInt(myValue)== myValue)
alert('Integer');
else
alert('Not an integer');

What Are Encryption Functions In Php?

CRYPT()
MD5()

What Types Of Images That Php Supports ?

Using imagetypes() function to find out what types of images are supported in your PHP engine.

imagetypes() - Returns the image types supported.

This function returns a bit-field corresponding to the image formats supported by the version of GD linked into PHP. The following bits are returned, IMG_GIF | IMG_JPG | IMG_PNG | IMG_WBMP | IMG_XPM.

What Is The Difference Between Htmlentities() And Htmlspecialchars()?
htmlspecialchars() - Convert some special characters to HTML entities (Only the most widely used)

htmlentities() - Convert ALL special characters to HTML entities.

How 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');

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.

What Is Meant By Mime?
MIME is Multipurpose Internet Mail Extensions is an Internet standard for the format of e-mail. However browsers also uses MIME standard to transmit files. MIME has a header which is added to a beginning of the data. When browser sees such header it shows the data as it would be a file (for example image) Some examples of MIME types:

audio/x-ms-wmp
image/png
application/x-shockwave-flash

What Is The Difference Between Group By And Order By In Sql?
To sort a result, use an ORDER BY clause.
The most general way to satisfy a GROUP BY clause is to scan the whole table and create a new temporary table where all rows from each group are consecutive, and then use this temporary table to discover groups and apply aggregate functions (if any). ORDER BY [col1],[col2],...[coln]; Tells DBMS according to what columns it should sort the result. If two rows will have the same value in col1 it will try to sort them according to col2 and so on.

GROUP BY [col1],[col2],...[coln]; Tells DBMS to group (aggregate) results with same value of column col1. You can use COUNT(col1), SUM(col1), AVG(col1) with it, if you want to count all items in group, sum all values or view average.

Who Is The Father Of Php And Explain The Changes In Php Versions?
Rasmus Lerdorf is known as the father of PHP.PHP/F1 2.0 is an early and no longer supported version of PHP. PHP 3 is the successor to PHP/FI 2.0 and is a lot nicer. PHP 4 is the current generation of PHP, which uses the Zend engine under the hood. PHP 5 uses Zend engine 2 which, among other things, offers many additionalOOP features .

What Is The Functionality Of The Function Htmlentities?
htmlentities() - Convert all applicable characters to HTML entities
This function is identical to htmlspecialchars() in all ways, except with htmlentities(), all characters which have HTML character entity equivalents are translated into these entities.

How Can We Get The Properties (size, Type, Width, Height) Of An Image Using Php Image Functions?

To know the image size use getimagesize() function
To know the image width use imagesx() function
To know the image height use imagesy() function.


Post a Comment

Previous Post Next Post