hi everyone this is Raghu from tutorial dr.com and welcome to PHP video series so in this lecture we will see some examples of HP conditions so let’s open my text editor and create a new file inside the concepts so let’s name it save it as conditions dot PHP and let’s start with the PHP tag and here I am defining two variables 36 and I’m adding some value like 10 and then using another variable Y and I’m giving some value 10 I know what I’m doing now this is an example for if condition so if X is greater than dollar boy okay and now here we have to write some statements so echo X is bigger than 1 just you can’t write anything okay this is just the if condition and irrespective of the above statements I am giving something like that so this is a simple if condition so let’s save and open our browser inside the concepts we have conditions so if we see end of my file so I wrote this end of method just to you know make sure that we are getting some output so if you see the condition is false so that’s why this loop is not executed okay so this is an example of if condition so now I can demonstrate difference using the same example so here so if X is greater than Y just display X is bigger than Y if not display Y is bigger than X so so we are getting Y is bigger than X kind of my PHP file so this is an example for if-else so we have another thing called if-else if-else so why it is used so let’s take two you know both x and y values are same so let’s keep both or equal so now it will check X is greater than Y if it is true then it will display X is bigger than Y else it means if the condition is false it will also check if whether X is lesser than one so if this is true then it will give Y is bigger than X but make sense and even if that condition also false then we have another block saying that both x and y are equal are same okay so let’s go to the browser and River so both x and y are equal so this is how we will use if if-else if-else if-else conditions now let us take an example of you know the switch case so what can we do let’s comment out everything we don’t need this just we can keep that end of the page we file so if you remember how can we come in we can use the slash slash or we can use block commenting like slash star and star slash okay so let me you know okay so use simple example with switch okay so switch and followed by the variable it can be variable or value output it can be anything okay let me use a variable like so I’ll use de name something like that it can be anything equals so if you remember in our previous lectures we you know we saw a few examples with date so one of the example is W date of W what it will give is so before doing this let’s just echo what output will get it here so echo of 10 let’s go to the browser and reload so here it can zero okay sorry just day I simply you know I’ll take another example with em sorry for the confusion month it will be simple because if you use the days we have you know 30 days so it will be tough I’ll just use em so it is giving it s 9 means this is September okay so what can we do now please so let’s uncomment this so if the variable month if this is the condition and now the case okay we need 12 cases 1 2 3 4 5 otherwise let’s just write something ok values 110 we can echo as January you can equalize this is change let’s copy this 11 times so actually we don’t need that last one and because I want to use even the default block also so if it is one thing you know output test this is January it is 2 3 five six eight if not this case is true then the last and final one is December so let’s keep you tense dissemble save the code and let’s open browser so it is giving this is September so this is how we can use the conditions


Google Plus

Apache Zookeeper Tutorial

Apache Kafka Tutorial

Apache Kafka Security

Elasticserarch n Kibana

Java 8 Tutorial

Log4J Tutorial

Apache Storm Tutorial

SQLite Tutorial

Apache Ant Tutorial

Related Posts


Apache Kafka Commands Cheat sheet

Spread the loveKafka Topics List existing topics bin/kafka-topics.sh –zookeeper localhost:2181 –list Purge a topic bin/kafka-topics.sh –zookeeper localhost:2181 –alter –topic mytopic –config retention.ms=1000 … wait a minute … bin/kafka-topics.sh –zookeeper localhost:2181 –alter –topic mytopic –delete-config retention.ms
Read more…


What is Apache Maven | Apache Maven complete tutorial from scratch pdf

Spread the love In this post you will learn the complete tutorial of Apache Maven build tool What is Maven ? Apache Maven is a software project management and comprehension tool. Based on the concept
Read more…


Practical Guide for Web Development in 2018

Spread the loveWelcome to my practical guide  for web development in 2018 in terms of  technology and career. Before we start I just want to  mention a few things, you don’t need to learn  everything that
Read more…