PHP began as a small open source project that grew in popularity as more people realised its benefits. In 1994, Rasmus Lerdorf released the initial version of PHP.
“PHP: Hypertext Preprocessor” is a recursive abbreviation for “PHP: Hypertext Preprocessor.”
PHP is an HTML-enabled server-side programming language. It’s used to manage dynamic content, databases, and session monitoring and create full e-commerce websites.
MySQL, PostgreSQL, Oracle, Sybase, Informix, and Microsoft SQL Server are just a few of the databases it supports.
PHP runs quickly, especially when built as an Apache module on the Unix side. Once launched, the MySQL server performs even the most sophisticated queries with large result sets in record time.
POP3, IMAP, and LDAP are just a few of the important protocols that PHP supports. PHP4 included support for Java and distributed object architectures (COM and CORBA), allowing for the first time n-tier programming.
PHP is forgiving: The PHP programming language makes every effort to be as compassionate as possible.
The syntax of PHP is similar to that of C.
PHP’s most common applications
PHP performs system functions, such as creating, opening, reading, writing, and closing files on a system.
PHP can handle forms, which means it can gather data from files, save data to a file, send data via email, and return data to the user.
PHP allows you to add, delete, and alter elements in your database.
Cookies variables may be accessed, and cookies can be set.
You may limit visitors’ access to certain website sections using PHP.
It can encrypt data.
PHP Characteristics
Five key traits enable PHP’s practical nature. −
Simplicity
Efficiency
Security \sFlexibility
Familiarity
PHP “Hello World” script
Start with basic PHP programmes to gain a feel for PHP. Because “Hello, World!” is such an important example, we’ll start with writing a simple “Hello, World!” script.
PHP is incorporated in HTML, as previously stated. That means you’ll see PHP statements like this in your standard HTML (or XHTML if you’re cutting-edge) code.
html> html> html> html> html> html>
/head> /head> /head> /head> /head> /head> /head> /head> /head> /head> /head> /head
??????????
php echo “Hello, World!”;?> php echo “Hello, World!”;?> php echo “Hello, World!”;?> php echo “H
</html>
It will result in the following outcome:
Hello, Universe!
Looking at the HTML output from the preceding example, you’ll see that the PHP code is missing from the file transmitted from the server to your browser. The PHP in the Web page is processed and removed off the page, leaving just pure HTML output for the client to get from the Web server.
All PHP code must be enclosed in one of the three ATE markup elements that the PHP Parser recognises.
?php PHP code goes here?>?php PHP code goes here?>?php PHP code goes here?
<? Here’s where you put your PHP code?>
php is the script language. /script> is where PHP code goes.
The?PHP…?> tag is one of the most often used tags. We’ll use the same title in our lesson as well.
We’ll start with setting up a PHP environment on your system in the following chapter, and then we’ll go through practically all of the PHP principles to get you familiar with the language.