Hello, in this PHP video I am going to cover with you how to print out using the echo command. So the echo command is simple Echo, you put something like a Hello, semicolon to end the line and a refresh. It says hello. So print out, you might think is it useful beyond that? Yes, when we get into variables, you'll be able to print out variables. The other thing you could do is some sort of calculation which could be stored in a variable then printed out or just directly done here, you know, a spot on five should give us a result of 25, which it does.
Okay, that is pretty darn cool. The other thing we could do is actually print out HTML. And my thinking, why would you want to print HTML instead of white in white? Yes, explain in a second. And so let's say if I wanted to put on just put it for Italia I'm gonna put Hello, Cliff. Hi Rhonda.
As you can see, it is, you know, in italics. So the reason you might want to use, you know, HTML tags in an echo command is because depending on, let's say, some sort of calculation that you've made, or some input from the user, maybe some result from a database that may determine the type of HTML you're printing, so maybe you literally are creating some sort of other online text editor. And if the tax button is pressed for you should be printed is in Italian. If not, then he won't be in italics. So that is a great example of that. A nerfing.
You know, this is more of a general sort of preference. If you want to you can actually put this in brackets. And when you put it in brackets, it's still it. Basically the same fan base, just a preference. If you prefer that format over this format, that is fine as well. But again, that's just more of a preference than anything up, I will actually leave it in there by this content just so you can see from the source code, what the format is like.
And I'll explain commenting in the, you know, in a separate video. Another thing that you can do is is to have multi line string. So multi line string is basically a string that spans multiple lines. So if I want to say let's say, Hello, and I want to put world and Mark, press semicolon to end it, we can do that as well. So as you can see, it still puts it all on one line, but if we just maybe, maybe the paragraph and we don't want the paragraph on a one liner We just saw you know, want to make a load, easy to read in code, then we can do this next month thinking okay, why don't we actually want to you know put it on separate lines. How do we do that?
So what we need is to put the you know, newline character which is backslash n, backslash n, backslash n, backslash n. And if I run that now not work to be honest. Let me try one thing. Nope, that didn't work and didn't work. Good couple bucks. Yeah. I'm gonna quit Google same job for God.
So PHP, a new long string backslash all backslash n it is totally strange. The character wrote a new line Unix wall for window day is the to tie to sequel to be unsafe. So use this one instead of you the one and this isn't on a new night. Actually, it is inside maybe that is missing. Nope. It's strange.
Obviously I could put you know, that sort of tag. Right there if I try the code you will find a new line in the string actually the new line isn't working for this either. You will find the new lines in this string to are going to do the NL to be all so far I do want to have new lines so I'm going to revert back to the way it was on the free here follow backslash just to be on the safe side that said you this one is dead. And we need to have an L to be y'all. There we go. So the NL to be on his new line to break rules.
So the break rule would be this nickel tag in HTML with put stuff on in line. So yeah, that is the echo command. We have multiple lines, you can put variables inside of it, which we're going to cover in a separate video. And yeah, that's it. The echo command is useful. So many things could be for debugging.
It could be just for pumping out content, you're going to be using a lot, trust me, and thanks for watching, and if you know any question, feel free to drop me a message and I look forward to seeing you in the next video.