What is php

Admin   PHP   73  2020-09-07 15:47:42

What is php?. PHP started as a small open source project, but as it progressed, more and more people found it to be more and more useful. PHP was developed from a product called PHP/FI. PHP/FI, created by Rasmus Lerdorf in 1994, was originally viewed as a simple subset of the Perl script code to track online access to his resume. He named this script "Personal Home Page Tools".

When broader functionality was needed, Rasmus wrote a larger C implementation that could query the database and help users develop simple web applications. Rasmus decided to publish the source code of PHP/FI for everyone to see, use, and fix the bugs in it, and improve the source code.

PHP writes the regression of "PHP: Hypertext Preprocessor".

PHP is a server-side scripting language that is embedded in HTML. It is used to manage dynamic content, Database, Session tracking, ...

It is integrated with several popular databases such as MySQL, PostgreSQL, Oracle, Sybase, Informix, and Microsoft SQL Server.

PHP is very well executed, especially when compiled as an Apache module on the Unix side. MySQL Server, when started up, executes complex queries with huge result sets in Record-setting time.

PHP supports a large number of major protocols such as POP3, IMAP, and LDAP. PHP4 added support for Java and distributed object constructs (COM and CORBA).

The PHP syntax is C-like.

Common uses of PHP

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

    PHP can process forms, for example: collect data from the file, save data to a file, via email you can send data, return data to the user.

    You can add, delete, and modify elements within your database through PHP.

    Access Cookie variables and set Cookies.

    Using PHP, you can restrict users from accessing certain pages of your Website.

    It can encrypt data.

what is php

Image: What is PHP

Characteristic of PHP

5 important features that make PHP quite convenient:

  •     Simplify
  •     Effective
  •     High security
  •     Flexible
  •     Friendly

"Hello World" Script in PHP

To get familiar with PHP, let's start with a simple PHP script. We'll start with our first PHP example "Hello, World" script.

As mentioned earlier, PHP is embedded in HTML. That is, inside HTML (or XHTML) you should be able to have PHP commands like these:

<html>
   
   <head>
      <title>Hello World</title>
   </head>
   
   <body>
      <?php echo "Hello World!";?>
   </body>

</html>

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

Hello World program in PHP

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

All PHP code must be wrapped inside one of 3 special markup identified by the PHP Parser.

<?php In this part is your PHP code ?>

<? In this part is your PHP code?>

<script language = "php"> In this section is your PHP code </script>

The most common tag is <?php ...?> And we will use the same tag in this series as well.

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

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

In the next chapter, we will cover the installation of the PHP environment on the computer and then discuss the basics related to PHP.