PHP Questions

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 2099
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 2090
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 2066
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 2059
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 2035
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 2003
Q:

Which function would you use to insert a record into a database?

Answer

The dba_insert() function adds a record to a database.

Report Error

View answer Workspace Report Error Discuss

Subject: PHP

0 1996
Q:

Are objects passed by value or by reference?

Answer Everything is passed by value.
Report Error

View answer Workspace Report Error Discuss

Subject: PHP

0 1983