Syntax
As you saw in our previous lesson where we did a simple Hello World, like so:
PHP<!DOCTYPE html>
<html>
    <head>
        <title>Diving into PHP</title>
    </head>
    <body>
        <?php
            // Display the text 'Hello World'
            echo('Hello World');
        ?>
    </body>
</html>
 Hello World in PHP
Hello World in PHP
The core syntax of PHP is actually quite simple. To declare PHP code, simply begin the code with <?php and end it with ?>. Whatever is inside that will be interpreted as PHP code by the web server and executed.
In our example, the actual code being executed is a call to the PHP echo function. What this function does is simply take whatever it is given and echo it on the page. That is why you saw Hello World on the page even though the text wasn't included in a raw HTML form. Because PHP can and is commonly embedded within HTML pages, the final output will appear no different to the user than if the HTML had that text written directly, or hardcoded.
Comments
If you noticed above the call to echo, there was this:
PHP<?php
    // Display the text 'Hello World'
?>
That is a comment in PHP. A comment is text that will be completely ignored by the web server as if it were never placed there in the first place. Comments are useful for leaving notes both to yourself and others about the surrounding code.
A comment spanning a single line is done with two slashes // or the hash symbol #, like so:
PHP<?php
    // I am a single-line comment
    # I am also a single-line comment
?>
But you can also write a comment that spans multiple lines by creating a block comment, like so:
PHP<?php
    /*
        I
        am
        a
        block
        comment
    */
?>
Great, that covers basic PHP syntax and how to leave comments!
 Getting Started with TypeScript Getting Started with TypeScript
 How to Serve Static Files with Nginx and Docker How to Serve Static Files with Nginx and Docker
 How to Set Up Cron Jobs in Linux How to Set Up Cron Jobs in Linux
 How to build a Discord bot using TypeScript How to build a Discord bot using TypeScript
 How to deploy a PHP app using Docker How to deploy a PHP app using Docker
 How to deploy a Deno app using Docker How to deploy a Deno app using Docker
 How to deploy an Express app using Docker How to deploy an Express app using Docker
 Using Puppeteer and Jest for End-to-End Testing Using Puppeteer and Jest for End-to-End Testing
 Getting Started with Handlebars.js Getting Started with Handlebars.js
 Getting Started with Moment.js Getting Started with Moment.js
 Setting Up Stylus CSS Preprocessor Setting Up Stylus CSS Preprocessor
 Using Axios to Pull Data from a REST API Using Axios to Pull Data from a REST API
