What is PHP?

PHP started out as a small open source project, but on the rise, more and more people find it increasingly useful.

PHP started out as a small open source project, but on the rise, more and more people find it increasingly useful. PHP was developed from a product called PHP / FI. PHP / FI was created by Rasmus Lerdorf in 1994, originally seen as a simple subset of Perl script code to monitor the status of access to his resume online. He named this script set "Personal Home Page Tools". When more extensive functions are needed, Rasmus has written a larger C implementation to query the Database and help users develop simple web applications. Rasmus has decided to publish the source code of PHP / FI for everyone to see, use and fix the errors in it, and improve the source code.

PHP regression of "PHP: Hypertext Preprocessor".

PHP is a scripting language written for servers that are embedded in HTML. It is used to manage dynamic content, Database, Session tracking, .

It is integrated with some popular Database like MySQL, PostgreSQL, Oracle, Sybase, Informix, and Microsoft SQL Server.

PHP performs very well, especially when compiled as an Apache Module on Unix side. The MySQL Server, when started, executes complex queries with huge result sets in Record-setting time.

PHP supports a large number of large protocols like POP3, IMAP, and LDAP. PHP4 adds support for Java and distributed object structures (COM and CORBA). PHP syntax is like C.

General use of PHP

PHP implements system functions, for example, from files on a system, it can create, open, read, write and close them.

PHP can handle forms, for example, collecting data from files, saving data to a file, through email you can send data, returning data to users.

You can add, delete, modify elements within your Database via PHP.

Access Cookie variables and set Cookies.

Using PHP, you can restrict users from accessing some pages in your Website.

It can encrypt data.

Features of PHP

5 important features that make PHP a quite convenient language:

  1. Simplify
  2. Effective
  3. High security
  4. Flexible
  5. Friendly

"Hello World" Script in PHP

To get used to PHP, we start with a simple PHP script. We will start with the first example of PHP as "Hello, World" script.

As mentioned earlier, PHP is embedded in HTML. That is, inside HTML (or XHTML) you will be able to have PHP commands as follows:



Hello World Hello





Save the above program in a file named test.php in htdocs , then open the browser and type the address http:/// localhost: 8080 / test.php will result:

What is PHP? Picture 1What is PHP? Picture 1

If you check the HTML output of the example above, notice that PHP code is not present in the file sent from the Server to your web browser. All PHP content present in the site is processed from that page; The only thing returned to the Client from the Web Server is the pure HTML output.

All PHP code must be contained within one of the 3 special markup tags identified by PHP Parser.





The most popular card is and we will also use the same tag in this series.

For static sites or HTML websites when a user requests to view a website, the request will be sent to the server. The server here simply sends the website content that the user wants to see about the browser to the user.

For PHP pages when requesting to view the website, the Server will proceed to generate that web page from PHP source code to HTML source code, then transfer that source code to the web browser for users to see. Because web browsers cannot read PHP source code, they can only read HTML source code.

In the next chapter we will discuss installing the PHP environment on the computer and then discuss the basic concepts related to PHP.

Follow tutorialspoint

Previous article: Variable in PHP

Next article: Constants in PHP

4 ★ | 1 Vote