codegurukool.com · Free coding tutorials & online compiler

Home › PHP Tutorial › PHP install and syntax

PHP install and syntax

Set up PHP and learn the basic rules.

Install PHP (or XAMPP), save a file as index.php and start the built-in server with php -S localhost:8000. Every statement ends with a semicolon. Comments use //, # or /* */. Keywords like echo are not case-sensitive, but variable names are.

Example code

<?php
// a comment
# another comment
/* a multi-line
   comment */
echo "Statements end with a semicolon.";
Echo " Keywords are not case-sensitive.";
?>

Run this code in the online editor

← PHP installationPHP variables →