Php: Variables, Printing and Comments

Post Reply
J
Jason
Site Admin
Posts: 24
Joined: Sun Dec 21, 2025 8:56 pm

Php: Variables, Printing and Comments

Post by Jason »

Code: Select all

<?php

// php-variables-printing-and-comments.php

// It is a separate file linked to a .php page via the include keyword.

// This is a single line comment.

# This is also a comment.

/* This is a
multiline comment */

$team_name = "Houston Texans";

/*Variables must start with $ followed by 

underscore or letter. After that, it can contain 

underscores, letters or numbers */

echo 'The best NFL team in Texas is the' . ' ' . $team_name . ' ' . 'as of 2025.';

echo "The best NFL team in Texas is the $team_name as of 2025.";

# The above situation requires double quotes.

echo "The best NFL team in Texas is the {$team_name} as of 2025.";

?>
 

POSTREACT(ions) SUMMARY

Post Reply