What is PHP?

php is called hypertext preprocessor as its libraries are already compiled. when any person request for any php page in the address bar of the browser that request is first sent to the server then server interpret php files and return back response in form of Html.so it is called hypertext preprocessor.

  • PHP is an interpreted language, so there is no need for compilation of php code.
  • Php is the most popular scripting language for web application.
  • Php is a open source scripting language. It is a server side scripting language that is embedded in HTML (Hypertext markup language).
  • It is used to mange Dynamic content on the web.
  • Php scripts are executed on the web server such as(WAMP, XAMPP, LAMP, MAMP).

PHP is an HTML-embedded Web scripting language. This means PHP code can be inserted into the HTML of a Web page. When a PHP page is accessed, the PHP code is read or "parsed" by the server the page resides on. The output from the PHP functions on the page are typically returned as HTML code, which can be read by the browser. Because the PHP code is transformed into HTML before the page is loaded, users cannot view the PHP code on a page. This make PHP pages secure enough to access databases and other secure information.

History of PHP :-

  • In 1994 the development of php was started by Rasmus lerdorf.
  • On june 8, 1995 it was released publicly.
  • In 1998, php 3 was officially launched.
  • In 1999 Suraski and Gutmans providing the zend Engine.
  • On may 22, 2004 php4 was released and it was powered by zend engine 1.0.

What is php file.

  • Php files can contain text, html, javascript, and php code.
  • Php code are executed on the server and the result is returned to the browser as plain Html.
  • Php file have a default file extension of .php (dot php).

Why PHP?

  • Php runs on different platforms(windows, linux, unix, mac os etc)
  • Php is compatible with almost all servers (apache, IIS). Internet Information server.
  • Php support wide range of databases (mysql, oracle, sybase, microsoft sql server)

Scripting :-

Scripting languages, which can be embedded within HTML, commonly are used to add functionality to a Web page, such as different menu styles or graphic displays or to serve dynamic advertisements. These types of languages are client-side scripting languages, affecting the data that the end user sees in a browser window. Other scripting languages are server-side scripting languages that manipulate the data, usually in a database, on the server.
Scripting languages came about largely because of the development of the Internet as a communications tool. JavaScript, ASP, JSP, PHP, Perl, Tcl and Python are examples of scripting languages.

How Does PHP work?

Here the server simply sends an html files to the client. But if you instead type website url then request an php page. The server is put to work. The server first reads the php file carefully to see if there are any tasks that need to be executed only when the server has done what it is supposed to do. The result is send to the client. The client only see the result of the server's work not the actual instruction. This means if you click view source on a php page you don't see the php code.

PHP Syntax :-

  • A php scripts can be placed anywhere in the document (file).
  • A php script starts with OR
  • A php file normally contains html tags, and some php scripting code.

File Name : index.php



Php syntax


echo "Hello mahtab Habib";
?>


Note :-

  • Php is a case sensitive language.
  • Each code line in php must end with a semicolon.
  • With php, two basic statements to output text in the browser. "echo" and "print"
  • NOTE :-
    Echo is slightly faster than print.
    Parameters : echo allows more than one parameter where as print does not.
  • Expression :- print works like a function and returns true value after successfully executed.

Example

File Name :

print Hello Mahira, Hello Sana;
// it will generate error.
?>
Whereas
echo Hello Mahira, Hello Sana;
?>

Output :-

Hello Mahira Hello Sana

Wamp Server :-

WAMP (windows, apache, mysql, php) is all in one packages which install the basic programs, you will need to get a localhost running and to be able to build and run php scripts.





Previous Next


Trending Tutorials




Review & Rating

0.0 / 5

0 Review

5
(0)

4
(0)

3
(0)

2
(0)

1
(0)

Write Review Here