I welcome you back again to another video lecture in PHP.
And in this video lecture we go ahead and look at comments in PHP.
Oh, I saw comments play a vital role.
Yes.
Why I said it plays a vital role is because someone will say hey, this is comments.
What role does comments play?
Comments plays a vital role in PHP and in other programming languages, because you can actually use
comments to be able to make your work look more simplified and manageable.
So we can actually go to your work, understand what is happening, and then be able to manage your
code.
So comments are not doing that in PHP.
So let's go ahead and see.
We have this code equal.
And we go ahead and say uh welcome to p h p and a semicolon at the end thereof.
We'll go ahead and run this.
We have.
Welcome to PHP.
Now if I go ahead and write anything here, it's going to an error.
So yes, if I go ahead and check this out you see an error.
Now if I go ahead and try to convert this to be comments, what I need to do is I can put double O for
slash and go ahead and save this.
Ah first is the error is gone.
So anything that you write after this double forward slash is a comment.
Now if I go down here and I'm going to copy this, let's copy this again.
And I'll go ahead and paste that.
And then go ahead and write another thing.
And then we always know it's going to throw an error.
If I run this you have an error.
And then we go ahead and put this a hashtag and run this code.
The error is gone.
So you can use double for slash.
You can use a hashtag to actually create a single line comment.
In PHP it is called a single line comment.
If you use double forward slash or single hashtag, that is a single line comment.
Now why I say this plays a vital role in PHP and other programming languages is that you can actually
specify what this line of code is actually doing, or what this block of code or a function is a try
doing, and what someone wants to manage that.
Uh, the person can actually understand what this code is doing, and it can be able to actually, uh,
troubleshoot or work on your code or further improve that.
So you can see that it is very, very interesting.
Now we have what is called a multiple line comment.
Now if I go over here and put this word in here, you can see that if I run this code I have an error
because everything down here is no longer functioning.
What happened?
It happened because this is a multiple line comment that includes job.
So if I go down here and, uh, put in exteriors Serious and false lash again.
You can see if I run this code and nothing is printed out because everything, everything that is inside.
Here is a comment right now.
So is a multiple line comment.
Now if I go ahead and remove this, let's go down here and I'll go ahead and put a forward slash exteriors.
And then I'm going to type anything and move down to the next line and move down to the next line and
move down to the next line.
And now if I go ahead and save this, I'll run this code.
We'll go to PHP, we'll come to PHP.
Now let's go ahead and put a brick right in here and uh, run this code again.
Welcome to PHP.
So you can see we have single line comments with a double forward slash and the single hashtag.
Either one of them can be used as a single line comment.
Then for multiple line comments, use forward slash exteriors and whatever it is in there to any amount
of line is double line or multiple line comment, then You can actually use these to improve your code.
Write and tell people who are going to manage your code whatever a block of code is doing.
So that is very interesting.
So we're going to need that in the in this course we are actually going to always in this course we're
going to always meet comments, because I will be using that to actually make my code more easier and
able to implement some of the things I want to do.
So instead of deleting this, maybe I have these two I want to work with, one I can go ahead and put
the double forward slash.
And then that is a comment.
So I can actually now print out one.
So I hope that is cool.
Now if I go ahead and refresh this I have just one.
Welcome to PHP.
Now I can modify this and use that later somewhere else.
So go ahead and play around with it.
And if you have any question, please go ahead and use the question and answer section.
And I'm going to get back to you as soon as possible.
Thank you so much.
And I'm going to see you in the next video lecture.