PHP scripts are written inside <?php ... ?> tags. These tags tell the server to interpret the enclosed code as PHP.
echo or IF), but variables are case-sensitive.
A simple PHP script looks like this:
<?php // This is a single-line comment echo "Hello PHP!"; ?>
<?php ... ?>;// for single-line/* ... */ for multi-line.php extension
<!DOCTYPE html>
<html>
<body>
<h1>PHP Test</h1>
<?php
echo "This line is from PHP!";
?>
</body>
</html>
<?php
// This is a single-line comment
# This is also a single-line comment
/*
This is a multi-line comment
useful for longer notes.
*/
?>
;). Missing semicolons are a common beginner error!
echo and print to output content.<?php and use semicolons to end each command.
Help others discover Technorank Learning by sharing your honest experience.
Your support inspires us to keep building!