Notepad can be accessed on any version of Windows using ⊞ Win + R > Notepad. TextEdit can be accessed on Mac by going to Applications > TextEdit.

The code should look something like .

In Notepad, add . php to the end of the filename and enclose in double quotations. This ensures the file will not be converted into a basic text file by Notepad. Without the quotation marks, the file will become hello world. php. txt. Alternatively, you can select the drop down menu under Save as type and change it to “All Files (*. *)” which will leave the name exactly how you type it and the quotes will not be needed. In TextEdit, no quotations marks are necessary, but a popup will appear asking you to verify that you want the file saved as . php. Make sure you save the file to your “server’s” document root directory. Typically this is the folder named “htdocs” in your Apache folder on Windows, or /Library/Webserver/Documents on Mac, but can be set by the user manually.

The PHP engine itself never actually prints anything to your screen. Any output generated by the engine is sent to your browser as HTML. Your browser does not know that it’s getting PHP output. As far as the browser is concerned, it’s getting plain HTML.

You want your code to look something like: Hello World!";?>

Your code should look something like:;echo “How are you doing?”; ?>

If you didn’t add this, your output would look like this: Hello World!How are you doing?

The dollar sign ($) at the beginning tells PHP that $myVariable is a variable. All variables must start with the dollar sign, but the name of the variable can be anything. In the above example, the value is “Hello World!”, and the variable is $myVariable. You’re telling PHP to store the value at the right of the equal sign, into the variable at the left of the equal sign. A variable containing a text value is known as a string.

Your code might look something like:$myVariable = “Hello World!”;echo $myVariable;?>

Your code should look something like:

Note that integer values do not need to be contained in quotation marks. That will cause numbers to be treated as a text value like the “Hello World!” variable. Your code should look something like:

Any change to either integer variable would be reflected when printing the “$myTotal” variable with echo. Your code should look something like:

The first variable, $myVariable, contains a string value; “Hello World!”. Unless you change the value, $myVariable will always contain the value “Hello World!”. The echo statement prints the contained value of $myVariable.

The two variables, $mySmallNumber, and $myLargeNumber are each assigned an integer value. The third variable, $myTotal, stores the added values of $mySmallNumber and $myLargeNumber. Since $mySmallNumber holds one numeric value, and $myLargeNumber holds a second numeric value, this means $myTotal holds the value of the first number added to the second number. This value can change with alterations to either of the included variables.