Use do while loop to calculate power in PHP

Description

The following code shows how to use do while loop to calculate power.

Example


<?php/*www  . j a va2  s  .  c  o m*/
    $count = 11;
    do {
        echo "$count squared = ".pow($count,2). "<br />";
    } while ($count < 10);
?>

The code above generates the following result.





















Home »
  PHP Tutorial »
    Language Basic »




PHP Introduction
PHP Operators
PHP Statements
Variable
PHP Function Create
Exception
PHP Class Definition