Please enable JavaScript to view this site.

Process Designer

Navigation: PHP API > Introduction to PHP

Syntax and error solving

Scroll Prev Top Next More

In order that PHP is able to fully load the content of the file example.php, you must follow the mandatory syntax of PHP. To display a text, this text has to be put between apostrophes and has to end with a semicolon. Not putting them will cause PHP to show an error. The following example is missing the apostrophes surrounding the text:

<?php

echo Hello World!;

?>

This will cause the following error to be displayed:

PHP Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in example.php on line 2

Most PHP errors are caused by a missing semicolon at the end of a statement, missing brackets or other little mistakes. To quickly fix this error, the output must be analyzed. Particularly important are the given file (example.php) and the line, in which the error occurred (line 2). According to this error output, the error can be found in the second line of the file example.php. If you have a look at this line, you can instantly see the missing apostrophes and correct the error.

<?php

echo "Hello World!";

?> 

The file is loaded successfully and no more errors are displayed.