LearnPHP TutorialPHP Syntax

PHP Syntax

1 min read

PHP Syntax

A PHP script starts with <?php and ends with ?>. Statements end with a semicolon ;.

<?php
echo "This is a statement";
echo "So is this";
?>

Comments

// This is a single-line comment
# This is also a single-line comment
/* This is a
   multi-line comment */

PHP is case-sensitive for variable names but not for keywords like echo, if, while.