The script

The file starts with <?php and prints exactly what it promised.

A PHP program file starts with <?php. Everything before that tag goes to the client as text. In the exercise output that is stray garbage, and the check will not accept it. In a pure PHP file you do not write the closing ?>: a line break after it becomes output too.

echo prints values one after another. A line break is the character \n inside double quotes. Inside single quotes \n stays as two characters. For a single practice phrase, double quotes and echo "Hello, Tropa\n" are simplest.

A statement ends with a semicolon. A variable name starts with $. Case matters in variable names: $Name and $name are different variables. Function names ignore case, but you should still write them in one style, or someone else's file becomes hard to read.

A parse error is not a "warning at the bottom of the page". In the sandbox it stops the check. Read the syntax error message and fix the line instead of putting @ in front of the expression. @ hides the symptom in a service as well.

Practice

  1. How the file starts

    Which tag opens PHP code?

    • <?php
    • <script>
    • package php
    • <?go
  2. Quotes

    Where does the sequence \n become a line break: in double quotes or in single quotes? Answer "double" or "single".

  3. The first line

    Print exactly Hello, Tropa followed by a line break.