Math calculation : Math « Math « PHP






Math calculation

 
<?
    $somevar = 5 + 5; // 10
    $somevar = 5 - 5; // 0
    $somevar = 5 + 5 - (5 + 5); // 0
    $somevar = 5 * 5; // 25
    $somevar = 10 * 5 - 5; // 45
    $somevar = $somevar . "appended to end";
    $somevar = false;
    $somevar = !$somevar; // $somevar is now set to true
    $somevar = 5;
    $somevar++; // $somevar is now 6
    $somevar--; // $somevar is now 5 again
    ++$somevar; // $somevar is 6
?>
  
  








Related examples in the same category

1.Create and use a simple static Math() class
2.Math operations
3.Mathematical constants
4.Hyperbolic Functions