Do...While Loop in PHP
It executes a block of code once without checking any conditions and then runs continuously until the condition is satisfied.
//Block of code
while( condition )
Output for the above code : 0
Explanation : We have initialised our variable $i=0. We have given the condition that $i should be greater than 5. If $i is not greater than 5, it will not continue the loop. But because this is a post tested loop, the loop will run once before checking the condition. So even though $i is not greater than 5 it entered the loop and printed "0" and then the condition does not satisfy, hence it exits the loop.
© Copyright - 2018 - 2021 | All rights reserved at Funda of Web IT