<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="https://script.spoken-tutorial.org/skins/common/feed.css?303"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>https://script.spoken-tutorial.org/index.php?action=history&amp;feed=atom&amp;title=PHP-and-MySQL%2FC2%2FLogical-Operators%2FEnglish</id>
		<title>PHP-and-MySQL/C2/Logical-Operators/English - Revision history</title>
		<link rel="self" type="application/atom+xml" href="https://script.spoken-tutorial.org/index.php?action=history&amp;feed=atom&amp;title=PHP-and-MySQL%2FC2%2FLogical-Operators%2FEnglish"/>
		<link rel="alternate" type="text/html" href="https://script.spoken-tutorial.org/index.php?title=PHP-and-MySQL/C2/Logical-Operators/English&amp;action=history"/>
		<updated>2026-05-13T01:24:40Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.23.17</generator>

	<entry>
		<id>https://script.spoken-tutorial.org/index.php?title=PHP-and-MySQL/C2/Logical-Operators/English&amp;diff=828&amp;oldid=prev</id>
		<title>Pravin1389: moved PHP-and-MySQL/C2/Logical-Operators /English to PHP-and-MySQL/C2/Logical-Operators/English</title>
		<link rel="alternate" type="text/html" href="https://script.spoken-tutorial.org/index.php?title=PHP-and-MySQL/C2/Logical-Operators/English&amp;diff=828&amp;oldid=prev"/>
				<updated>2012-12-01T13:09:03Z</updated>
		
		<summary type="html">&lt;p&gt;moved &lt;a href=&quot;/index.php/PHP-and-MySQL/C2/Logical-Operators_/English&quot; class=&quot;mw-redirect&quot; title=&quot;PHP-and-MySQL/C2/Logical-Operators /English&quot;&gt;PHP-and-MySQL/C2/Logical-Operators /English&lt;/a&gt; to &lt;a href=&quot;/index.php/PHP-and-MySQL/C2/Logical-Operators/English&quot; title=&quot;PHP-and-MySQL/C2/Logical-Operators/English&quot;&gt;PHP-and-MySQL/C2/Logical-Operators/English&lt;/a&gt;&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;tr style='vertical-align: top;'&gt;
				&lt;td colspan='1' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan='1' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Revision as of 13:09, 1 December 2012&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan='2' style='text-align: center;'&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(No difference)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Pravin1389</name></author>	</entry>

	<entry>
		<id>https://script.spoken-tutorial.org/index.php?title=PHP-and-MySQL/C2/Logical-Operators/English&amp;diff=527&amp;oldid=prev</id>
		<title>Chandrika: Created page with '{| border=1 !Time !Narration |- |0:0 |Hello and welcome to a tutorial on &quot;Logical Operators&quot;.  Its a very brief tutorial but I will keep it like that at the moment. |- |0:09 |I'l…'</title>
		<link rel="alternate" type="text/html" href="https://script.spoken-tutorial.org/index.php?title=PHP-and-MySQL/C2/Logical-Operators/English&amp;diff=527&amp;oldid=prev"/>
				<updated>2012-11-29T06:32:38Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;#039;{| border=1 !Time !Narration |- |0:0 |Hello and welcome to a tutorial on &amp;quot;Logical Operators&amp;quot;.  Its a very brief tutorial but I will keep it like that at the moment. |- |0:09 |I&amp;#039;l…&amp;#039;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{| border=1&lt;br /&gt;
!Time&lt;br /&gt;
!Narration&lt;br /&gt;
|-&lt;br /&gt;
|0:0&lt;br /&gt;
|Hello and welcome to a tutorial on &amp;quot;Logical Operators&amp;quot;.  Its a very brief tutorial but I will keep it like that at the moment.&lt;br /&gt;
|-&lt;br /&gt;
|0:09&lt;br /&gt;
|I'll use an example of an &amp;quot;if&amp;quot; statement again because that's all I have got at the moment. &lt;br /&gt;
|-&lt;br /&gt;
|0:18&lt;br /&gt;
|What is a logical operator? Let's add a bit of logic and say its the 'and' or the 'or' operator.  &lt;br /&gt;
|-&lt;br /&gt;
|0:27&lt;br /&gt;
|Now if I start creating my basic layout for my &amp;quot;if&amp;quot; statement i will get to work on showing you what you can do with these. &lt;br /&gt;
|-&lt;br /&gt;
|0:43&lt;br /&gt;
|Before we had example such as 1 is greater than 1 which at the moment is going to return 'false'&lt;br /&gt;
|-&lt;br /&gt;
|0:54&lt;br /&gt;
|let's just check it to see where we are.... right . So that's &amp;quot;false&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|1:02&lt;br /&gt;
|Now what if I said &amp;quot;if 1 is greater than 1 or 1 equals 1&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|1:18&lt;br /&gt;
|Now we don't write it as 'or' we write it as two horizontal lines or two pipes.&lt;br /&gt;
|-&lt;br /&gt;
|1:27&lt;br /&gt;
|Not quiet sure about that but if know my keyboard it would next to the shift key - two horizontal lines and that means 'or'.&lt;br /&gt;
|-&lt;br /&gt;
|1:38&lt;br /&gt;
|So if we compile this what do you think the result is gonna be? &lt;br /&gt;
|-&lt;br /&gt;
|1:43&lt;br /&gt;
|Now let's run through this once - if 1 is greater than 1 - &amp;quot;false&amp;quot; and so we have written &amp;quot;false&amp;quot; or 1 is equal to 1...&lt;br /&gt;
|-&lt;br /&gt;
|1:54&lt;br /&gt;
|We know that 1 equals to 1 is &amp;quot;true&amp;quot; so here we are saying 'or' 1 is equal to 1 not 'and' because if we said 'and' then both would have to be &amp;quot;true&amp;quot;. &lt;br /&gt;
|-&lt;br /&gt;
|2:04&lt;br /&gt;
|or either of these could be &amp;quot;true&amp;quot; to make this.&lt;br /&gt;
|-&lt;br /&gt;
|2:07&lt;br /&gt;
|The output. So hopefully we will get &amp;quot;true&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|2:14&lt;br /&gt;
|Okay so that's the 'or'.&lt;br /&gt;
|-&lt;br /&gt;
|2:17&lt;br /&gt;
|It basically allows you to take two comparisons, show them into your &amp;quot;if&amp;quot; statement and if either of them are &amp;quot;true&amp;quot; - so its like an &amp;quot;either&amp;quot; operator...&lt;br /&gt;
|-&lt;br /&gt;
|2:29&lt;br /&gt;
|&amp;quot;either&amp;quot; of them are &amp;quot;true&amp;quot;, you will be left with &amp;quot;true&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|2:35&lt;br /&gt;
|&amp;quot;and&amp;quot; operator is a different matter.&lt;br /&gt;
|-&lt;br /&gt;
|2:39&lt;br /&gt;
|&amp;quot;and&amp;quot; requires both of these to be &amp;quot;true&amp;quot; for this to be executed. &lt;br /&gt;
|-&lt;br /&gt;
|2:44&lt;br /&gt;
|So we have get &amp;quot;false&amp;quot; here because 1 is not greater than 1.&lt;br /&gt;
|-&lt;br /&gt;
|2:51&lt;br /&gt;
|We go back to our comparison operators and we will say &amp;quot;if 1 is greater than or equal to 1 'and' 1 equal 1&amp;quot;, here we will get &amp;quot;true&amp;quot;. &lt;br /&gt;
|-&lt;br /&gt;
|3:01&lt;br /&gt;
|So now, all I can really think about is to add a few variables in to test this.&lt;br /&gt;
|-&lt;br /&gt;
|3:08&lt;br /&gt;
|But I am pretty sure that you have got the hang of variables by now, by following my other tutorials.&lt;br /&gt;
|-&lt;br /&gt;
|3:12&lt;br /&gt;
|So these are the two logical operators.&lt;br /&gt;
|-&lt;br /&gt;
|3:17&lt;br /&gt;
|You will find them very useful because you might want to say for example - this is a very classic example. You'll find it in one of my projects....&lt;br /&gt;
|-&lt;br /&gt;
|3:27&lt;br /&gt;
|It is a &amp;quot;login&amp;quot; form.  Say a user wants to login to a website.&lt;br /&gt;
|-&lt;br /&gt;
|3:34&lt;br /&gt;
|You've probably logged into a website before and it said to enter your &amp;quot;username&amp;quot; and &amp;quot;password&amp;quot;. Now the keywords are in there. &lt;br /&gt;
|-&lt;br /&gt;
|3:40&lt;br /&gt;
|We need to check if the users have entered the &amp;quot;username&amp;quot; and the &amp;quot;password&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|3:44&lt;br /&gt;
|If they haven't, there is no point in comparing the &amp;quot;username&amp;quot; to the &amp;quot;password&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|3:48&lt;br /&gt;
|So we can say, for example, &amp;quot;if username and password&amp;quot;.  &lt;br /&gt;
|-&lt;br /&gt;
|3:52&lt;br /&gt;
|In fact let's do this. I'll say &amp;quot;username&amp;quot; is equal to &amp;quot;alex&amp;quot; and my password is equal to &amp;quot;abc&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|4:04&lt;br /&gt;
|Now I will substitute these. I can say &amp;quot;username&amp;quot; and &amp;quot;password&amp;quot;. &lt;br /&gt;
|-&lt;br /&gt;
|4:11&lt;br /&gt;
|At the moment, this will say &amp;quot;true&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|4:15&lt;br /&gt;
|I'll change this.  I'll say 'ok' or 'you forgot to fill out a field' because there will eventually be HTML fields.&lt;br /&gt;
|-&lt;br /&gt;
|4:27&lt;br /&gt;
|This is going to be okay because we have got both values.&lt;br /&gt;
|-&lt;br /&gt;
|4:32&lt;br /&gt;
|So let's try it. Yes, that's saying &amp;quot;ok&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|4:37&lt;br /&gt;
|Now what happens if I forget to type my password in there? There's nothing in there at the moment - no space - lets get rid of that. &lt;br /&gt;
|-&lt;br /&gt;
|4:45&lt;br /&gt;
|'You forgot to fill out a field'.&lt;br /&gt;
|-&lt;br /&gt;
|4:50&lt;br /&gt;
|So if you imagine these are coming from the user - so it's been submitted as you typed your &amp;quot;username&amp;quot; and &amp;quot;password&amp;quot; in.&lt;br /&gt;
|-&lt;br /&gt;
|4:57&lt;br /&gt;
|We are saying &amp;quot;username&amp;quot; and &amp;quot;password&amp;quot;; basically &amp;quot;username&amp;quot; itself is &amp;quot;true&amp;quot; because it exists... &lt;br /&gt;
|-&lt;br /&gt;
|5:03&lt;br /&gt;
|If you had that inside, that would be acceptable; that would be &amp;quot;true&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|5:14&lt;br /&gt;
|We'll just check that there you go.&lt;br /&gt;
|-&lt;br /&gt;
|5:18&lt;br /&gt;
|So because we have got &amp;quot;username&amp;quot; and &amp;quot;password&amp;quot; then that's fine.&lt;br /&gt;
|-&lt;br /&gt;
|5:23&lt;br /&gt;
|But for the 'or' that doesn't really makes sense and you can imagine what will happen.&lt;br /&gt;
|-&lt;br /&gt;
|5:28&lt;br /&gt;
|So right now, this will equal &amp;quot;true&amp;quot; because we have got both values.  So this is 'ok'.&lt;br /&gt;
|-&lt;br /&gt;
|5:36&lt;br /&gt;
|Now if I go with both of them and try it out.&lt;br /&gt;
|-&lt;br /&gt;
|5:42&lt;br /&gt;
|&amp;quot;if the username exists&amp;quot; so if the username is &amp;quot;true&amp;quot;...&lt;br /&gt;
|-&lt;br /&gt;
|5:46&lt;br /&gt;
|At the moment there is no value - so its &amp;quot;false&amp;quot;. &lt;br /&gt;
|-&lt;br /&gt;
|5:48&lt;br /&gt;
|&amp;quot;or the password is true&amp;quot; - that is, the value exists; at the moment it doesn't, so it is &amp;quot;false&amp;quot;. &lt;br /&gt;
|-&lt;br /&gt;
|5:52&lt;br /&gt;
|So we are going to say  &amp;quot;You forgot to fill out a field&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|5:56&lt;br /&gt;
|I'll just write here nothing because at the moment it means nothing.&lt;br /&gt;
|-&lt;br /&gt;
|6:03&lt;br /&gt;
|So refresh and we get nothing. &lt;br /&gt;
|-&lt;br /&gt;
|6:05&lt;br /&gt;
|So you see, already I have explained how useful these can be in so many every day php applications.&lt;br /&gt;
|-&lt;br /&gt;
|6:13&lt;br /&gt;
|For example - a form someone can fill in. You will find many other users for it.&lt;br /&gt;
|-&lt;br /&gt;
|6:16&lt;br /&gt;
|But that's it then.&lt;br /&gt;
|-&lt;br /&gt;
|6:19&lt;br /&gt;
|Two operators that are logical operators.&lt;br /&gt;
|-&lt;br /&gt;
|6:24&lt;br /&gt;
|Just try them out and see what all you can do with them.&lt;br /&gt;
|-&lt;br /&gt;
|6:28&lt;br /&gt;
|I will be using these most definitely in one of my projects quite soon.&lt;br /&gt;
|-&lt;br /&gt;
|6:30&lt;br /&gt;
|Thanks for watching. &lt;br /&gt;
|-&lt;br /&gt;
|6:35&lt;br /&gt;
|This is Sidharth dubbing for the Spoken Tutorial project.&lt;/div&gt;</summary>
		<author><name>Chandrika</name></author>	</entry>

	</feed>