P HP code can be placed anywhere inside a document.
It can be placed in any HP email tag including CSX AP HP script starts with the open HP tag and must
be closed with the closing tag
in this page.
PTA we have an echo statement This statement will display the content inside the quotes.
In this case.
Hello World AP AP statement must end with a semicolon.
We've also embedded an HD PML tag the H R tag inside the echo statement.
This will display a horizontal line after our hello world text.
And here it is in our web browser.
We can see the text hello world with the horizontal line beneath
we can create comments and HP that are not read or executed as part of the page in our web browser.
The purpose of a comment is to provide information to a programmer analyzing the code comments are very
important in HP because scripts can become lengthy and complicated especially to someone who is trying
to understand the functions or arithmetic that you've coded.
In this example we've illustrated three different formats for creating comments the double slash and
no sign can be used for single line comments.
We can create multi line comments using these slash and asterisks combination
and so you can see that none of this is actually displayed in the web browser.
It's only for somebody interpreting the code
we can insert comments inside arithmetic to leave out parts of the code line as shown here.
We have the equation x is equal to 10 plus five plus 20.
As you can see five has been commented out so the result of this equation will be 30 as seen in our
web browser because we're only adding 10 plus 20
for now.
Don't worry about Variable Declaration.
We'll be covering that independently in another lesson.
Pee pee is not case sensitive when dealing with classes in functions such as an if statement l statements
while an echo statements
in this case each echo statement would work despite differences in case.
So in the first example we have echo in capitals and the desired output is text sample one with a horizontal
line underneath and we can see that it outputs just fine.
Next we have lower case echo and it's the same line that we're output outputting just change sample
one to sample to and we can see that it outputs fine as well.
Lastly we have echo with the e and see capitalized and Agent 0 lowercase and the output text sample
3 with the horizontal line underneath his output it
note however that variable names are case sensitive in this example.
We have a variable named car which contains the value of all Bill.
We then have three echo statements each time changing the case of the variable output car
only the first line will output the variable correctly because the case does not match in the second
in third line so we can see here in the first line
the variable to be output it matches the case of the variable itself.
And so it outputs correctly.
My car is a Volvo in the second and third example.
The case does not match and for that reason we receive 2 error messages undefined variable car.
And once again the same message here.
Notice that the case is incorrect and that's why we get those messages if you're unable to see error
messages you'll need to do the following
click on your web or map icon go to the HP menu.
Select P2P settings
and make sure there's an a checkmark next to display errors.
If that's not there then you will not see error messages in your web browser.