The “do { } while (condition) { }” construct in PHP
PHP has two “while†constructs, one if the code needs to run before the condition is checked:
and the other if if the code needs to run after the condition is checked:
But sometimes a portion of code needs to be executed before the condition is checked, and another portion after the condition is checked. Here is an example directly from the php ducomentation:
This is an easy problem that can be solved with an assignment in condition, it generates a warning but it does not break the code.
[Read More]