Difference between revisions of "PHP-and-MySQL/C2/Comparison-Operators/English-timed"
From Script | Spoken-Tutorial
(Created page with '{| border=1 !Time !Narration |- |0:00 |In this PHP tutorial we will learn about Comparison Operators. |- |0:05 |Comparison Operators can compare 2 values, 2 strings or 2 variable…') |
|||
(3 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
{| border=1 | {| border=1 | ||
− | + | |'''Time''' | |
− | + | |'''Narration''' | |
|- | |- | ||
− | | | + | |00:00 |
− | |In this PHP tutorial we will learn about Comparison Operators. | + | |In this '''PHP''' tutorial, we will learn about '''Comparison Operators'''. |
|- | |- | ||
− | | | + | |00:05 |
− | |Comparison | + | |Comparison operators can compare 2 '''values''', 2 '''strings''' or 2 '''variables''' that can contain any of them and will act upon that. |
|- | |- | ||
− | | | + | |00:15 |
− | |For this I am going to use an | + | |For this, I am going to use an '''if''' statement. |
|- | |- | ||
− | | | + | |00:19 |
− | | | + | |Let's start by creating the '''if''' statement structure. |
|- | |- | ||
− | | | + | |00:25 |
− | |My condition is if 1==1 | + | |My '''condition''' is '''if 1==1''', |
|- | |- | ||
− | | | + | |00:30 |
− | |echo | + | |'''echo''' |
|- | |- | ||
− | | | + | |00:33 |
− | |True | + | |'''True''' |
|- | |- | ||
− | | | + | |00:37 |
− | |and then else | + | |and then '''else''' |
|- | |- | ||
− | | | + | |00:42 |
− | |echo | + | |'''echo''' |
|- | |- | ||
− | | | + | |00:44 |
− | |False. Remember I don't need these brackets so I'm going to take them out. | + | |'''False'''. Remember, I don't need these brackets; so I'm going to take them out. |
|- | |- | ||
− | | | + | |00:51 |
− | | | + | |Let's '''indent''' it. |
|- | |- | ||
− | | | + | |00:56 |
|Never mind the indenting. | |Never mind the indenting. | ||
|- | |- | ||
− | | | + | |00:59 |
|This is the first comparison operator. | |This is the first comparison operator. | ||
|- | |- | ||
− | | | + | |01:02 |
− | |Two | + | |Two 'equals to' (==) means the 'comparison operator'. We've seen this in the '''if''' statement before. |
|- | |- | ||
− | | | + | |01:08 |
− | |1 does equal to 1 so this will echo True. | + | |1 does equal to 1; so this will '''echo''' "True". Let's try it. |
|- | |- | ||
− | | | + | |01:13 |
− | |We got True. | + | |We got '''True'''. |
|- | |- | ||
− | | | + | |01:15 |
− | |Let me change this. | + | |Let me change this. '''if''' 1 is greater than 1 (1>1) then let's see what result we get. |
|- | |- | ||
− | | | + | |01:27 |
− | |False, because 1 is equal to 1 and not greater than 1. | + | |'''False''', because 1 is equal to 1 and not greater than 1. |
|- | |- | ||
− | | | + | |01:33 |
− | |Now | + | |Now let's change this to 1 greater than or equal to 1 (1>=1). |
|- | |- | ||
− | | | + | |01:37 |
− | | | + | |'''if''' 1 greater than or equal to 1, '''echo''' "True" else '''echo''' "False". |
|- | |- | ||
− | | | + | |01:45 |
− | |Here we should get True. | + | |Here, we should get '''True'''. |
|- | |- | ||
− | | | + | |01:48 |
− | |You can also do the same with less than or equal to. So for example less than | + | |You can also do the same with 'less than or equal to'. So, for example: less than (<) |
|- | |- | ||
− | | | + | |01:55 |
− | |would be False, less than or equal to would be True. | + | |would be '''False''', less than or equal to (<=) would be '''True'''. |
|- | |- | ||
− | | | + | |02:01 |
− | |We can also say not equal. So if 1 is not equal to 1 echo True | + | |We can also say 'not equal'. So, if 1 is not equal to 1 (1!=1) '''echo''' '''True'''. |
|- | |- | ||
− | | | + | |02:11 |
− | |Refresh. We'll get False here because 1 is equal to 1. Now | + | |Refresh. We'll get '''False''' here because 1 is equal to 1. Now let's say if 1 isn't equal to 2 (1!=2). |
|- | |- | ||
− | | | + | |02:20 |
− | |We get True because 1 is not equal to 2 | + | |We get '''True''' because 1 is not equal to 2. |
|- | |- | ||
− | | | + | |02:25 |
− | |These are the basic | + | |These are the basic comparison operators that you will be using for our tutorials. |
|- | |- | ||
− | | | + | |02:33 |
− | |Expand on this - practice them - and you'll understand them better | + | |Expand on this - practice them - and you'll understand them better. |
|- | |- | ||
− | | | + | |02:40 |
− | |You can also compare variables using these operators. | + | |You can also compare variables using these operators. So for example: num1 = 1, |
|- | |- | ||
− | | | + | |02:48 |
− | |num2 = 2. | + | |num2 = 2. All we now do is, replace these values and there we go. |
|- | |- | ||
− | | | + | |03:01 |
− | |This will produce exactly the same result as we've got earlier | + | |This will produce exactly the same result as we've got earlier which is '''True'''. Now all we need to do is, change these values. |
|- | |- | ||
− | | | + | |03:11 |
− | |Please note this will now read as num1 = 1 num2 = 1 | + | |Please note, this will now read as num1 = 1, num2 = 1. So if 'num1' doesn't equal 1 it is "False" because 1 does equal 1 therefore we get '''False'''. |
|- | |- | ||
− | | | + | |03:24 |
− | |These here are the simple | + | |These here are the simple comparison operators. Play around with them. See what you can do. Thanks for watching. |
|- | |- | ||
− | | | + | |03:33 |
− | |This is Mad Madhur dubbing for the Spoken Tutorial Project. | + | |This is Mad Madhur, dubbing for the Spoken Tutorial Project. |
|- | |- |
Latest revision as of 12:50, 12 June 2015
Time | Narration |
00:00 | In this PHP tutorial, we will learn about Comparison Operators. |
00:05 | Comparison operators can compare 2 values, 2 strings or 2 variables that can contain any of them and will act upon that. |
00:15 | For this, I am going to use an if statement. |
00:19 | Let's start by creating the if statement structure. |
00:25 | My condition is if 1==1, |
00:30 | echo |
00:33 | True |
00:37 | and then else |
00:42 | echo |
00:44 | False. Remember, I don't need these brackets; so I'm going to take them out. |
00:51 | Let's indent it. |
00:56 | Never mind the indenting. |
00:59 | This is the first comparison operator. |
01:02 | Two 'equals to' (==) means the 'comparison operator'. We've seen this in the if statement before. |
01:08 | 1 does equal to 1; so this will echo "True". Let's try it. |
01:13 | We got True. |
01:15 | Let me change this. if 1 is greater than 1 (1>1) then let's see what result we get. |
01:27 | False, because 1 is equal to 1 and not greater than 1. |
01:33 | Now let's change this to 1 greater than or equal to 1 (1>=1). |
01:37 | if 1 greater than or equal to 1, echo "True" else echo "False". |
01:45 | Here, we should get True. |
01:48 | You can also do the same with 'less than or equal to'. So, for example: less than (<) |
01:55 | would be False, less than or equal to (<=) would be True. |
02:01 | We can also say 'not equal'. So, if 1 is not equal to 1 (1!=1) echo True. |
02:11 | Refresh. We'll get False here because 1 is equal to 1. Now let's say if 1 isn't equal to 2 (1!=2). |
02:20 | We get True because 1 is not equal to 2. |
02:25 | These are the basic comparison operators that you will be using for our tutorials. |
02:33 | Expand on this - practice them - and you'll understand them better. |
02:40 | You can also compare variables using these operators. So for example: num1 = 1, |
02:48 | num2 = 2. All we now do is, replace these values and there we go. |
03:01 | This will produce exactly the same result as we've got earlier which is True. Now all we need to do is, change these values. |
03:11 | Please note, this will now read as num1 = 1, num2 = 1. So if 'num1' doesn't equal 1 it is "False" because 1 does equal 1 therefore we get False. |
03:24 | These here are the simple comparison operators. Play around with them. See what you can do. Thanks for watching. |
03:33 | This is Mad Madhur, dubbing for the Spoken Tutorial Project. |