I will call you back again to another video lecture in PHP.
In this video lecture we go ahead and look at the variables in PHP.
So right on my screen I have a little story I just made for us.
And this says once upon a time in the land of Alaska, there was a man named Peter who is 80 years old.
Peter lived in Alaska for 80 years.
One day Peter left Alaska and never returned again.
So this is a piece of story, a formalized story that we have right in here.
So this can be a novel, maybe up to 100 pages, 200 or 300 pages.
And in that novel, you might have a Alaska name like up to 100 times, and you have the name Peter
Are occurring about 200 times, and these may occur as many times as possible.
Then, if we go ahead and run this graph, let's go ahead and save.
These are the.
Check it out.
So it says on a.
Once upon a time in the land of Alaska, there was a man named Peter who is 80 years.
All right.
I think this is so big.
I'll go ahead and I'll reduce this.
And now everything is now alright.
So once upon a time, in the land of Alaska, there was a man named Peter who is 80 years old.
Peter lived in Alaska for 80 years.
One day Peter left Alaska and never returned again.
So you can see in this story I can do to change anything.
Let me say I'm the editor who is editing this book, and I want to change the name Alaska to maybe anything.
Maybe I can name that to be, or here or any other thing.
So I'll go ahead and start changing this one by one.
So I'll go right in here.
I change this and I come over here.
I change this as well.
Then the next place is the last one.
I will change this again.
So if I go ahead and save this or run this code, you can see that Alaska has been changed.
And now we have Ohio right in here.
So the state has changed from this to once upon a time in the land of oo.
That was a man named Paul and no longer Peter, who is 80 years old.
Paul lived in Ohio for 80 years.
One day Paul left Ohio and never returned again.
Maybe Paul is dead or Paul has relocated.
What is 80 years?
So this is just a story.
And you can see I am changing the names one by one.
So this is easier for if four lines of code I can actually do that.
Or what if this is a whole novel and you want to do this?
So how do you start changing this one by one without making a mistake.
There must be a time, or you might miss some steps, or you might miss on names.
Or you might write something that is not just what is supposed to be.
Maybe there is a typo somewhere.
So how can you be able to do this?
You know, how can you change this with just a line of code?
So let me go ahead and introduce us to what variables are.
So variables are a containers that contain a particular piece or a word that you want to use any place
in your code.
So anytime you want to change a son, a name or a number or a decimal number or an integer variable,
anything, you can actually use variable to do that.
Now I'll go ahead and show us how to do that because it's just a container.
And now it's actually learn by doing so.
In order to write a variable in Python what we need to do is we go ahead and use the dollar sign.
So this dollar sign is what is going to help us to be able to declare a variable.
So once you create a name or that symbol.
Dollar sign, it means that the next thing that comes is a variable.
Now let's go ahead and see.
This is a story.
Now we call the story.
Town is a town where you want to change.
Let me see.
I want to name this town, um, or camcorder to be.
Um, let me call that to be any name town.
So the town name is now Newton.
And I can also go ahead and change the name.
Now, how do I change the story name?
Let me call out to the story name.
You can call it anything.
It's just a variable is a container that holds, um, a piece of information which can be able to use
any place.
All right.
So I name the first one the town story town, the name I call it to be story.
You can name it.
You can give it any name you want.
All right.
It mustn't be story name.
Now I'm going to change that to be the record out to be George.
Then I will go ahead and give the last one to reach.
All right.
So I can change the age to be 95.
All right.
Put a semicolon at the end.
Now, you can see that when I was giving this, I call this I give a this inside a quotation mark.
Because this is a string.
We have not discussed strings and we have not talked anything about integers and strings.
But this is a string.
That is why it is inside a double quotation mark.
So what does an integer.
You don't need that.
You just leave it the way it is.
Okay, now let's go ahead and save this.
So the next thing I have to do is I'll go to Ohio and I'm going to change this to story and let me see.
Story town.
All right.
So story town, let me go ahead and save this.
And we're going to run this code and check it out.
Now you can see once upon a time in the land of Luton and no longer Ohio, what happens?
Even though I did add a little right in here, what actually happens is that the variable name has been
stored inside this variable container named Story Town.
And any time or any place you see Story Town, what is going to be there is Luton.
So if you change this Luton to anything, let me say if you call out to be Manchester, so let's call
it out to be Manchester and let's go ahead and run.
This is considered in the land of Manchester so it can actually change.
So it's just a container that is holding a piece of information.
So whatever you put inside there is what is going to be displayed.
Now I'll go ahead and copy this.
Let's go ahead and copy this.
And then we go over here.
Any place you see or hear we change that with this variable name.
And I'll go ahead and change this as well.
So go ahead and change this as well.
Are we okay.
I actually copied that.
Let me go ahead and copy this again.
All right.
So I'll go ahead and paste this here.
And then the story name is the name of the individual.
So change this to story Name and change this to Store name.
And wherever we see both with the story and then the Stone age, we got it on copyright.
So let's go back to Etsy and we change this.
and we also change this.
Now we can actually save this and then go back.
Go back here and run this code and check it out.
So once upon a time in the land of Manchester, there was a man named George who is 95 years old.
George lived in Manchester for 95 years.
One day George left Manchester and never returned again.
So you can see that we are able to change everything right in here.
So if this story is like up to, um, 100 lines of code, we can actually go back here and go back to
here and say Manchester, go back to Alaska.
Let's go back to Alaska.
And, uh, the name go back to Peter and the age go back to 80.
Let's save this and run this code again.
So once upon a time, in the land of Alaska, there That was a man named Peter who is 80 years old.
Peter lived in Alaska for 80 years.
One day, Peter left Alaska and never returned again.
So we can see that we were able to use variables to be able to do all this without going back right
inside the stories to modify that one by one.
So that is one cool effect.
And one thing good about PHP.
So PHP actually knows when you are using a variable and it will automatically obey that.
Okay, so whatever it is inside the variable, it actually gives you back to you.
Because variable is just a container that we use to hold some piece of information.
So that is cool.
All right.
So go ahead and practice with this.
Check it out.
And if you have any questions on anywhere it just let me know.
And I'm going to get back to you as soon as possible.
All right.
So I want us to move together.
And for any reason you have any problem, please don't forget to use the question and answer section.
And I'm always going to get back to you.
So thank you and see you in the next video lecture.