What is Variable
Variable is just a Storage place.You can put many types of items into the storage place (Variable) so you can use them and manipulate it in your programmes. You can store anything like numbers and texts.
if you understand this idea of storages place (Variables).Then you can move to the next topic. But if you do not understand the concept of the Variables. Then suppose you want to catalogue whatever like clothes collection. if someone told you can you arrange this clothes according to the gender then how you can do this, you just pick clothes one by one and create a stack of two parts men or women right, now then stack name man who holds the men's clothes and women clothes that will be denoted as a storages place its mean a men and women are variables understand.
Suppose You check what number of coats you have, and after that offer these to the man. You tally what number of shoes you have, and offer these to the lady. Shockingly, you have a terrible memory. The inquiry is, which one of your people (Variable) holds the coats and which one holds the shoes? To enable you to recollect, you can give your people names! You could call them something like this:
mr_Coats
mrs_Shoes
You can give any type of name to your variables it totally depends on you like:-
man_coats
woman_shoes
But you remember one thing if you have a bad memory choose that name who easily help you to remember it.
When you create a Variable one thing you will always be remembered you can't start your variable name by (_) underscore or a number.
Alright, so your people (Variable) now have the name. Yet, it's awful simply giving them a name. They will be doing some work for you, so you have to disclose to them what they will do. The man will be holding the coats. In any case, we can indicate what number of coats he will hold. On the off chance that you have ten coats to give him, at that point you do the "telling" this way:
mr_Coats=30
In this way, the variable name starts things out, at that point an equivalents sign. After the equivalents sign, you tell your variable what it will do. Holding the number 30, for our situation. (The equivalents sign, incidentally, isn't generally an equivalents sign. It's called a task administrator. In any case, don't stress over it, at this stage. Simply recall that you require the equivalents sign to store things in your Variable.)
In any case, you're learning PHP, so there's something missing. Two things, really. To begin with, your people(Variable) require a dollar sign toward the starting (individuals are that way). So it would be this:
$mr_Coats=30
In the event that you miss the dollar sign out, at that point, your people will decline to work! Be that as it may, the other thing missing is something extremely demanding and fastidious - a semi-colon. Lines of code in PHP require a semi-colon toward the end:
if you understand this idea of storages place (Variables).Then you can move to the next topic. But if you do not understand the concept of the Variables. Then suppose you want to catalogue whatever like clothes collection. if someone told you can you arrange this clothes according to the gender then how you can do this, you just pick clothes one by one and create a stack of two parts men or women right, now then stack name man who holds the men's clothes and women clothes that will be denoted as a storages place its mean a men and women are variables understand.
Suppose You check what number of coats you have, and after that offer these to the man. You tally what number of shoes you have, and offer these to the lady. Shockingly, you have a terrible memory. The inquiry is, which one of your people (Variable) holds the coats and which one holds the shoes? To enable you to recollect, you can give your people names! You could call them something like this:
mr_Coats
mrs_Shoes
You can give any type of name to your variables it totally depends on you like:-
man_coats
woman_shoes
But you remember one thing if you have a bad memory choose that name who easily help you to remember it.
When you create a Variable one thing you will always be remembered you can't start your variable name by (_) underscore or a number.
Alright, so your people (Variable) now have the name. Yet, it's awful simply giving them a name. They will be doing some work for you, so you have to disclose to them what they will do. The man will be holding the coats. In any case, we can indicate what number of coats he will hold. On the off chance that you have ten coats to give him, at that point you do the "telling" this way:
mr_Coats=30
In this way, the variable name starts things out, at that point an equivalents sign. After the equivalents sign, you tell your variable what it will do. Holding the number 30, for our situation. (The equivalents sign, incidentally, isn't generally an equivalents sign. It's called a task administrator. In any case, don't stress over it, at this stage. Simply recall that you require the equivalents sign to store things in your Variable.)
In any case, you're learning PHP, so there's something missing. Two things, really. To begin with, your people(Variable) require a dollar sign toward the starting (individuals are that way). So it would be this:
$mr_Coats=30
In the event that you miss the dollar sign out, at that point, your people will decline to work! Be that as it may, the other thing missing is something extremely demanding and fastidious - a semi-colon. Lines of code in PHP require a semi-colon toward the end:
$mr_Coats=30;
On the off chance that you get any parse mistakes when you endeavour to run your code, the primary thing to check is whether you've missed the semi-colon off the end. It's anything but difficult to do and can be baffling. The following thing to check is whether you've passed up a great opportunity a dollar sign. Yet, back to our people (Variables).
So the man is holding Thirty coats. We can do a similar thing with the other individual (variable):
$mrs_shoes = 25;
Along these lines, $mrs_shoes is holding an estimation of 25. In the event that we at that point needed to include what number of things of garments we have up until now, we could set up another variable (Note the dollar sign at the beginning of the new Variable):
$total_clothes
We would then be able to include the coats and the shoes. You include in PHP like this:
$total_clothes = $mr_coats + $mrs_shoes;
Keep in mind, $mr_coats is holding an estimation of 30, and $mrs_shoes is holding an estimation of 25. In the event that you utilize an or more sign, PHP supposes you need to include. So it will work out the aggregate for you. The appropriate response will then get put away in our new factor, the one we've called $total_clothes. You can likewise include this way:
$total_clothes = 30 + 25;
Once more, PHP will see them, in addition, to sign and include the two together for you. Obviously, you can include in excess of two things:
$total_clothes = 30 + 25 + 8 + 34 + 1230;
Be that as it may, the thought is the same - PHP will see in addition to signs and afterwards include things up. The appropriate response is then put away in your variable name, the one to one side of the equivalents sign.
No comments
Post a Comment