MENU
Home » 2016 » March » 25 » PHP interview questions and answers part 2
8:34 AM
PHP interview questions and answers part 2





#php interview questions and answers

#PHP interview questions and answers part 2

Write the statements that are used to connect PHP with MySQL

The statements that can be used to connect PHP wil MySQL is:

?

$conn = mysql_connect('localhost');

echo $conn;

This statement gets the resource of the localhost. There are other different ways with which you can connect to the database and they are as follows:

?

How to use HTTP Headers inside PHP? Write the statement through which it can be added?

?header('Location: http://www.php.net')?

The headers can be added to HTTP response in PHP using the header(). The response headers are sent before any actual response being sent. The HTTP headers have to be sent before taking the output of any data. The statement above gets included at the top of the script.

Why PHP is also called as Scripting language?

PHP is basically a general purpose language, which is used to write scripts. Scripts are normal computer files that consist of instructions written in PHP language. It tells the computer to execute the file and print the output on the screen. PHP is used for webpages and to create websites, thus included as scripting language.

Why many companies are switching their current business language to PHP? Where PHP basically used?

PHP is rapidly gaining the popularity and many companies are switching their current language for this language. PHP is a server side scripting language. PHP executes the instructions on the server itself. Server is a computer where the web site is located. PHP is used to create dynamic pages and provides faster execution of the instructions.

What is the use of PEAR in php?

PEAR is known as PHP Extension and Application Repository. It provides structured library to the PHP users and also gives provision for package maintenance.

What is the difference between PHP and JavaScript?

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..



Views: 539 | Added by: mega_tyfuk-1982 | Tags: Part, questions, PHP, and, Interview, Answers | Rating: 0.0/0
Total comments: 0
avatar