PHP acre loop method amongst syntax in addition to example

PHP WHILE LOOP METHOD

PHP piece loops permit you lot to execute the same slice of code continuously piece a sure enough status is true. Once the status becomes false, the plan volition interruption out of the loop together with proceed processing the remainder of the page.

SYNTAX OF PHP WHILE LOOP


while (condition)   {   Code to hold upwards executed while the status is true;   }

EXAMPLE OF PHP WHILE LOOP

$sharePrice = 1; while ($sharePrice <= 10)   {   echo "The part cost is " . $sharePrice . ". Don't sell yet. <br />";   $sharePrice = $sharePrice + 1;   } echo "The part cost is " . $sharePrice . ". SELL NOW!";

RESULT OF THIS EXAMPLE

The part cost is $1. Don't sell yet.
The part cost is $2. Don't sell yet.
The part cost is $3. Don't sell yet.
The part cost is $4. Don't sell yet.
The part cost is $5. Don't sell yet.
The part cost is $6. Don't sell yet.
The part cost is $7. Don't sell yet.
The part cost is $8. Don't sell yet.
The part cost is $9. Don't sell yet.
The part cost is $10. Don't sell yet.
The part cost is $11. SELL NOW!

Belum ada Komentar untuk "PHP acre loop method amongst syntax in addition to example"

Posting Komentar

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel