 Dear students, in this module, we will talk about the variables which are used in PHP. And of course, they have certain properties and attributes, which are not as per what you may have been studying or using. So let's go into the details of the module coverage. So we will talk about using and naming variables, parts of the variables, different data types which are used in PHP, PHP about loose typing and strong typing. In PHP, there's something just called as loose typing. I will talk about it, testing the type of the variable and changing the variable data type. The purpose is that when you are communicating with the end user through your application, how do you work with the variables? How do you work with different data types? Because when you are interfacing or connecting through a form, they are different fields in the form, and they are different data types associated with those fields. And PHP has a very different approach, which I will talk about very shortly that you really don't have to declare the variables as in other programming languages. So why do we need the variables? Variable is a container of a value, as you may already know. And since the contents of that container can vary over a period of time, can change because of different operations, therefore they are called as variables. For example, if you just print or echo 2 plus 2, right, and then you would like to change the values, then you have to make those changes at maybe one place or at many places. The variable help you facilitate and make those changes at limited or at only a single place. So in PHP, the variables name start with the dollar sign. And subsequent to the dollar sign, there can be a letter, English letter or an underscore. So you are not allowed to use a number after the dollar sign. And remember that the variables which are declared in PHP, they are case sensitive. It means that if you have a variable dollar sign G is capital ET dollar get, that variable is treated differently from dollar get if the G was uppercase or capital. So I believe you understand the difference between the two names of the variable which may sound or spell exactly the same, but they are represented differently. So PHP is case sensitive, that is the bottom line. So creating the variables in PHP is called as declaring the variable as you can see on the screen. And the wonderful thing is about PHP that you can use the variables without declaring them. It means that you don't have to create the variable and then use it. As you are proceeding in your program, you can write a variable and start using it using of course the the nomenclature which I explained to you very briefly in the previous slide. But there is one problem over here that if you use a variable which does not exist and use it in a certain operation, this may generate you got it. This will not generate an error message. And when that error message is not generated, then it's very difficult to debug that error. Why? Because there was no error message. So you may be getting some unexpected results because of using variables, which of course you had not declared earlier. And it is difficult to fix that error and bug because it's a logical error. And one practice is about variables is initializing the variables. It is better that when you declare the variable, you initialize the variable. And if the variable is not initialized, then the default null value is assigned to the variable. Now the question is why would you like to assign a value to a declared variable? Because when somebody is reading your code, they would know and they would understand what value was assigned to that variable. Now there are eight data types which are used in PHP, which are the scalar data type, which consists of single value. And then you have compound data type, which can consist of multiple values. For example, for that array, you have a value and you have an index at which that value is stored. And then you have special data types. So overall there are eight different data types, which makes PHP very versatile in terms of data types which are available to do the web programming. Now as I mentioned in the beginning of the module, that PHP is loosely typed. Loosely typed means that when you assign or when you create a variable and you start using it, then depending upon the context in which the variable is used, the type gets assigned to the variable. To make it understand, for example, you create an integer variable and then you add a floating point number. It becomes a floating variable and then you append something, append some text to it and it becomes a string variable. So you see that the type, the data type of the variable changes as you go ahead applying different operations. But Java or say, see, they are strongly typed because once you assign the data type to the variable throughout the running of the program, the type does not changes. So we have certain positive aspects and negative, good or bad with reference to the type. Good is obvious. It makes it very flexible to work with variables in PHP, but there are no error messages when there's a type mismatch and these bugs are difficult to track down, which I also discussed. Now when you have all those different types of variables, okay, there has to be a mechanism of testing the type of the variable. So over here you can get the type of the variable using this command, get type of the variable. So you assign a value to a variable that sets the type of the variable and then you use the get type command, which will tell you over here through if the type is as per what it was assigned. And of course, you can also change the type of the variable also over here using the set type command, you type, you change the variable type set type and set type, okay. And the correspondingly you can see the results which are displayed over here.