PHP originally meant Personal Home Page. it became later a recursive acronym: PHP Hypertext P rocessor. PHP is an open source language designed for web applications. PHP is used to generate dynamically HTML pages from the server.
Historically, HTML pages were stored in
.html files. All
users fetched the same page from the server. Quickly, the need for personalized
pages were felt. For example, to authenticate a user and
display only information that concerns him, such as his messages. this is why PHP
has been designed for. It allows to create a dynamique (or personalized, or specifics)
If your new to PHP, you have to understand the fundamental difference between PHP and HTML: HTML is interpreted on the client side, while PHP is executed on the server side. To simplify the difference between client and server:
The languages PHP, ASP.NET, node.js are server-side languages, they run on the server. It is the result of execution (usually HTML) which is sent to the client.
The following diagram summarizes the principle of the relationship between the client and the server in the case of a dynamic website.
https: // lucidar.mewhich will actually be
https: // lucidar.me / index.php.
index.phpwhich is at the root of the site. The result of this processing is HTML code.
Here is an example of a PHP script below. You will find that the two languages
(HTML and PHP) are mixed in the same file. Here, HTML is
sent to client as is, while PHP is running on the server. This is the output of the
<h1> Hello World </h1> which is inserted in the HTML:
<html> <head> <title>PHP Test</title> </head> <body><a class="btn btn-primary" href="/fr/web-dev-class/lesson-4-01-introduction-to-php/" role="button"><span class="d-md-inline d-none">Cours 3.1 </span><i class="fi-cnsrxl-chevron-solid"></i></a> <?php echo '<h1>Hello World</h1>'; ?> </body> </html>
We understand here that the
echo function will allow to display content in
the HTML page. This instruction is similar to the C / C++
printf () function.
Write a PHP script that displays the 6 heading titles.