PHP Questions

Q:

What is MIME?

Answer

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.

Report Error

View answer Workspace Report Error Discuss

Subject: PHP

0 2350
Q:

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

Answer

By default the maximum size is 2MB. and we can change the following
setup at php.iniupload_max_filesize = 2M

Report Error

View answer Workspace Report Error Discuss

Subject: PHP

0 2325
Q:

What are the different functions in sorting an array?

Answer

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

Report Error

View answer Workspace Report Error Discuss

Subject: PHP

0 2274
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

Report Error

View answer Workspace Report Error Discuss

Subject: PHP

0 2267
Q:

What is a PHP Filter?

Answer

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.

Report Error

View answer Workspace Report Error Discuss

Subject: PHP

0 2235
Q:

What is the use of $_Server and $_Env?

Answer

$_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

View answer Workspace Report Error Discuss

Subject: PHP

0 2232
Q:

What is the difference between PHP and JavaScript?

Answer

The difference lies with the execution of the languages. PHP is server side scripting language, which means that it can’t interact directly with the user. Whereas, JavaScript is client side scripting language, that is used to interact directly with the user.


 

Report Error

View answer Workspace Report Error Discuss

Subject: PHP

0 2228
Q:

How do you pass a variable by value?

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

View answer Workspace Report Error Discuss

Subject: PHP

0 2227