# PHP Questions

Q:

What’s the difference between include and require?

Answer It’s how they handle failures. If the file is not found by require(), it will cause a fatal error and halt the execution of the script. If the file is not found by include(), a warning will be issued, but execution will continue.

Subject: PHP - Technology

2122
Q:

What is MIME?

MIME - Multi-purpose Internet Mail Extensions.

MIME types represents a standard way of classifying file types over Internet.

Web servers and browsers have a list of MIME types, which facilitates files transfer of the same type in the same way, irrespective of operating system they are working in.

A MIME type has two parts: a type and a subtype. They are separated by a slash (/).

MIME type for Microsoft Word files is application and the subtype is msword, i.e. application/msword.

Subject: PHP - Technology

2118
Q:

What are the different functions in sorting an array?

sort() , rsort(), asort()
ksort()   , usort()
arsort()  , uksort()
natsort() , natcasesort()
array_multisort()

Subject: PHP - Technology

2112
Q:

How do you pass a variable by value?

Answer Just like in C++, put an ampersand in front of it, like $a = &$b

Subject: PHP - Technology

2104
Q:

What is the use of $_Server and$_Env?

$_SERVER and$_ENV arrays contain different information. The information depends on the server and operating system being used. Most of the information can be seen of an array for a particular server and operating system. The syntax is as follows:

foreach($_SERVER as$key =>$value) { echo “Key=$key, Value=$value\n”; } Report Error Subject: PHP - Technology 2090 Q: How can we encrypt the username and password using PHP? Answer User names and passwords in PHP can be encrypted using md5 function. MD5 function calculates the md5 hash of a string. It is basically used for encryption. It is also used for digital signature applications, where a large file must be "compressed" in a secure manner. Example: Md5($str);

Crypt() function can also be used to encrypt a string,. It used MD5, DES or blow fish algorithms for encryption.

Syntax:

Crypt(str, salt)

Salt is an optional parameter used to increase the number of characters encoded, to make the encoding more secure

Subject: PHP - Technology

2074
Q:

What is a PHP Filter?

A PHP filter is used to validate and filter data coming from insecure sources.
To test, validate and filter user input or custom data is an important part of any web application.
The PHP filter extension is designed to make data filtering easier and quicker.

Subject: PHP - Technology

2038
Q:

What is the use of super-global arrays in PHP?

Super global arrays are the built in arrays that can be used anywhere. They are also called as auto-global as they can be used inside a function as well. The arrays with the longs names such as $HTTP_SERVER_VARS, must be made global before they can be used in an array. This$HTTP_SERVER_VARS check your php.ini setting for long arrays.