PHP syntax issues, but don't quote me

Comments and Quotes

I am studying Web Design and have set up both a localhost and remote site development environments to test my code. I am using PHP7.1. * When commenting using the “//” syntax the comments and the symbols are printed to the screen. * When using “\n” or “\t” in double quote strings the new line or tab function does not parse even though the characters are not printed. * When saving a “.inc” file in Notepad++, the file is treated as a Pascal file for syntax highlighting instead of a php include file. I checked the site for syntax changes in the newer versions but could not find these. The textbook I’m dealing with is using php 5.4 as a base.

Can you copy/paste the complete contents of your php script here, so I can take a look and try to answer your question? Also, what operating system are you running your PHP7.1 (Linux or Windows or Mac)? To make the code more readable and to keep your code spacing, make sure to use three back ticks before and after the pasted code. The back tick is usually located left of the 1 key near the top of the keyboard. I use php for many projects, so I should be able to assist you.

By default, Notepad++ associated file extension “.inc” with Pascal.
If I remember correctly, you can change this association in Settings > Preferences > File Association.
Or, change Settings > Style Configurator > Language > PHP.

I have a Windows 8.1 environment at school and a Mac OS Sierra 10.12.3 at home.

The first issue came to me from realizing that PHP files inhabit HTML docs like a parasite but that the comments must live within PHP itself to be parsed. I tested and it worked, so that is one down.

The “.inc” include file issue stems from an old school naming convention preferred by the author of the course material. My online instructor stated that I can just use “.php” for include files and jamesperrin told me how to change “File Association” in Preferences in Notepad++. That is two down.

As for the double quote issue, the backslash n and backslash t are toward the bottom of the file. Here is the to the online file. It is just test scripts from a textbook that I am playing with to learn the code. ```<!doctype html>

Variables and Constants

<?php $name = "Joe Strummer"; $band = "The Clash"; $color = "Green"; $number = 42; $team = "Wolverhampton Wanderers"; ?>

Full Name: <?php echo $name; $band="";?>

<?php define("DATE","Feb 20th, 2008"); ?>

<?php echo ($color); ?>

Favorite band: <?php echo $band; ?>

<?php var_dump($band); ?>;

<?php echo ($color); ?>

<?php ?> <?php echo DATE; $month = "December"; $result1 = "$month"; $result2 = '$month'; echo $result1,"
"; echo $result2; ?>

$stringall = “Hello\t to\t \nthe”;
$stringall .= “\t World!”;
echo $stringall;

Thanks for the information. The course I’m taking needs to be updated as it relates to versions of PHP that are no longer current(including a few pages on PHP 4) and conventions that were kind of made up by the author. The confusion in being new is that navigating outdated material and new iterations dampens confidence. Every ounce of information that you can provide dispels the fear. Cheers.