PHP learning notes for beginners

more_vert
PHP learning notes for beginners

more_vert

verified

Basic PHP Syntax

A PHP script can be placed anywhere in the document.

A PHP script starts with <?php and ends with ?>:

<?php
// PHP code goes here
?>

The default file extension for PHP files is ".php".

more_vert

In PHP, keywords (e.g. ifelsewhileecho, etc.), classes, functions, and user-defined functions are not case-sensitive.

more_vert

Note: However; all variable names are case-sensitive!
Look at the example below; only the first statement will display the value of the $color variable! This is because $color$COLOR, and $coLOR are treated as three different variables: