Every PHP statement ends with a semicolon ;, and PHP code blocks are wrapped in <?php and ?> tags. You can freely mix PHP and HTML in the same file — PHP only executes what's inside the tags:
<!DOCTYPE html>
<html>
<body>
<h1><?php echo "Welcome!"; ?></h1>
<?php if (date('H') < 12): ?>
<p>Good morning.</p>
<?php else: ?>
<p>Good afternoon.</p>
<?php endif; ?>
</body>
</html>
PHP is case-sensitive for variable names but case-insensitive for function and class names (though matching case is still best practice). Whitespace and indentation are not significant — they exist purely for readability.
echo and print both output text; echo is marginally faster and can take multiple comma-separated arguments, while print always returns 1 and takes only one argument. Most PHP developers default to echo.
If a file is pure PHP with no trailing HTML, it's best practice to omit the closing ?> tag entirely — this avoids accidental whitespace being sent to the browser after the tag.