PHP Questions

Q:

What is a Session?

Answer

A session is a logical object created by the PHP engine to allow you to preserve data across subsequent HTTP requests. Sessions are commonly used to store temporary data to allow multiple PHP pages to offer a complete functional transaction for the same visitor.

Report Error

View answer Workspace Report Error Discuss

Subject: PHP

0 2362
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 2337
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 2286
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 2277
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 2251
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 2244
Q:

What’s the difference between htmlentities() and htmlspecialchars()?

Answer

Htmlentities() converts all applicable characters to HTML entities. While htmlspecialcharacter()converts special characters to HTML entities. This means htmlentities( ) will check for non English language characters, such as French accents, the German umlaut, etc.

Report Error

View answer Workspace Report Error Discuss

Subject: PHP

3 2243
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 2240