Monday, October 31, 2016

php-page2

6. How do you execute a PHP script from the command line?

Ans:
Just use the PHP command line interface (CLI) and specify the file name of the script to be executed as follows:
php script.php

7. What is session and why do we use it?

Ans:
Session is a super global variable that preserve data across subsequent pages. Session uniquely defines each user with a session ID, so it helps making customized web application where user tracking is needed.

8. What is cookie and why do we use it?

Ans:
Cookie is a small piece of information stored in client browser. It is a technique used to identify a user using the information stored in their browser (if already visited that website) . Using PHP we can both set and get COOKIE.

9. What are the different errors in PHP?

Ans:
There are 4 basically types of error.
Parse Error – Commonly caused due to syntax mistakes in codes e.g. missing semicolon, mismatch brackets.
Fatal Error – These are basically run time errors which are caused when you try to access what can’t be done. E.g. accessing a dead object, or trying to use a function that hasn’t been declared.
Warning Error – These occurs when u try to include a file that is not present, or delete a file that is not on the server. This will not halt the script; it will give the notice and continue with the next line of the script.
Notice Error – These errors occurs when u try to use a variable that hasn’t been declared, this will not halt the script, It will give the notice and continue with the next line of the script.

10. What types of loops exist in php?

Ans:
for, while, do while and foreach



11. How can PHP and HTML interact?

Ans:
It is possible to generate HTML through PHP scripts, and it is possible to pass informations from HTML to PHP.

12. How can PHP and Javascript interact?

Ans:
PHP and Javascript cannot directly interacts since PHP is a server side language and Javascript is a client side language. However we can exchange variables since PHP is able to generate Javascript code to be executed by the browser and it is possible to pass specific variables back to PHP via the URL.

13. What is CSS?

Ans:
CSS or cascading Style Sheet is a way to style and present HTML.

14. What is AJAX?

Ans:
AJAX (Asynchronous JavaScript and XML) is a technique which allows updating parts of a web page, without reloading the whole page. Data is exchanged asynchronously in small amounts of data with the server.

15. What is jQuery?

Ans:
jQuery is a fast, small, and feature-rich JavaScript library. It is an easy-to-use API which makes things like HTML document traversal and manipulation, event handling, animation, and Ajax much simpler across a multitude of browsers.



<Back   I   Next>


EmoticonEmoticon