Hello, in this video, we are going to take a look at variables. So what is a well, variable, a variable is a data storage container. And he allows you to store just data. And to create a variable you put dollar. So that's how you know you're creating a variable. And there are some reserved keywords, make sure you don't you know, use any of these, but pretty much anything else is, is all right, but I've got a separate video covering variable naming.
So I'll cover more information in that about specific naming convention. I'm going to call this variable, not Akali. Baldwin, and to assign a value to it you put equals than the value that you want to assign. So maybe I'm gonna assign the value 100 semi colon, and if I run that, let's see what we get. Nothing changes. It's because we haven't done anything with it.
So if instead of instead of doing Hello, he wants to do 100 Like that, and save it. As you can see it print out 100, which is pretty darn cool. variables can essentially have any type of data could be a string of numbers. Again, I'm going to cover that in more depth in a nother video. And if you want to reassign the value to it, you basically do the same thing. barwon equals, let's say 200 now, so as you can imagine, what did I call 100?
Mentor coach, know the variable. So to echo you do VA want to do properly. So there we go, still printed 100 so that's how you access it to declare it. Unlike, you know, something like c++ where you might or you know, JavaScript, you know, in JavaScript to do something like var, you know, to barwon equals 100. So acid sort of format that you would see in JavaScript. And when you want to reuse it, you put var one to 200, that you don't do the variable keyword.
And in PHP, I mean in c++ or something like you know, in. in PHP, for example, you literally, there's no distinction between the first time that you declare variable and subsequent uses the, you know, the PHP interpreter, just know if it's the first time or not, it basically sets some storage side for a variable called var one in memory. And it assigns a value of 100. So if I was to do dollar, I'm gonna set it here dollar var one equals 200. For example, run down, still say 200 because 200 was assigned afterwards. But if I do echo dollar one, and I run that now we get 200 printed Which is pretty darn cool.
So how about if we want to combine variables and strings all in the same printer? So imagine if I'm gonna comment this out on top of this, maybe with some sort of input, and, you know, I've got the input and it's got my name on. And I essentially want to not be an echo that should be a variable, sorry. So I'm gonna put dollar equals, and maybe I sent you want to print out something like this. My name is phone like that, but I want this, you know that data to come from a variable. So what happened before this put your last name?
Yeah. As you can see, that works fine. So if I put you know, let's say Bruce Wayne here that works really well as well. So that is A way of combining the two. And there's actually another way that we can do it as well. So another cool way.
And we can actually put strings after this, though, so you can put like and epic, for example, as you can see, without distinction on our end, you know, the user then that this is from a variable, but in the back end, that's where it is coming from. So another way that we can replicate this, my comment that out, is to essentially end the tag, then per dot, then per dot again, and then we open the tab. And I would need space. For my thinking, why would you want to do that, that's great. If you want to do something a bit more than just embed a variable inside of it. Maybe you want to do some sort of calculation.
Maybe you have. Maybe you Dollar involve one equals $1 or two equals 90, I don't want to print out you know the, you know, the product of the soccer the dollar ball one time Boyd dollar bought two, his 900. So he allows us to essentially do a bunch of extra PHP stuff. So whether it's a calculation, or he's calling a method that returns from for a data, so that's where you would essentially you know, stop the string for a dot which is saying that you were expecting actual PHP code now, where it could go beyond just an embed of a variable. So yeah, that is how you use variable i think create them pretty basic stuff so far, but we are going to cover a you know, cover variables in more depth. If you have any questions, feel free to pop me a message and as usual, I will forward to see you in the next video.