Page 1 of 1

Php: Variables, Printing and Comments

Posted: Mon Dec 22, 2025 1:05 am
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.";

?>