hi this is Doug ooh from tutorial dr.com and welcome to PHP video series in this lecture we will see some examples on while loop so let’s open our favorite editor and inside the concept and creating a new folder so let me name it as loops and inside the loops let me create a new file so now we will see some examples a while for this one I’m giving the file image file dot PHP now we have our boiler PHP so start our PHP code with a special tag that is PHP tag and then so we will do slice variable maybe we will name it as count and we will give some value may be 0 or will it start with 0 and now I am using while loop the syntax for while loop is while and within the parentheses we need to give a condition so one dollar count is less than or equals 10 so execute this loop as soon as this variable value is less than R equals 10 and then inside the while loop we have to give some statements so what to execute so I’ll give echo of this is a repeated text and let me give a break so that we will get a nice output in each line we will get it and each echo we will get it new line so we will see what will happen if we run this file our PHP code so let’s open your favorite browser so just open that while dot PHP file so if you see it is loading loading loading it means there is something wrong that is nothing but if you open your PHP file so here we are using while loop and this condition is true so it will enter into the loop and again it will check it is true so it will repeat infinitum because we don’t have any condition to terminate the slope so what we will do here we will increment the value of count so count equals count plus 1 so it means now the count value 0 once it enters into the loop its value is 1 then 2 so after 10 iterations this condition will be false then this will be exited ok let’s save and reload ok you can see we have 10 lines of output so if you hear that sound my computer is started you know giving some buzzing sound this is because I just now I you know I started an infinity loop so because of that even our system then and it’s sometimes ok so let it will just settle by itself so we can also give +1 as plus equals 1 this is some short code as we saw in our previous lectures so the same output and we can give something like dot dollar cause so nice and good output here so this how we will use while do

Tags:






Youtube
Facebook
Google Plus
Twitter
TutorialDrive


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

blog

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…

blog

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…

blog

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…