PHP Classes

File: sample.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in Bookmark in
  Classes of Reza Salehi  >  complex  >  sample.php  >  Download  
File: sample.php
Role: Example script
Content type: text/plain
Description: sample.php
Class: complex
Performs operations on complex numbers
Author: By
Last change:
Date: 12 years ago
Size: 727 bytes


Class file image Download
    // this class gets 2 complex numbers and calculates add, sub, mul & div of them.
    // useful for educational use.
    //---- 2 complex number.
$c=new complex($n1, $n2);
    print (
'num1 = '.$n1['re'].' '.$n1['im'].'i'.'<br>');
    print (
'num2 = '.$n2['re'].' '.$n2['im'].'i'.'<br><br>');
    print (
'add = '.$sum['re'].' '.$sum['im'].'i'.'<br>');
    print (
'sub = '.$sub['re'].' '.$sub['im'].'i'.'<br>');
    print (
'mul = '.$mul['re'].' '.$mul['im'].'i'.'<br>');
    print (
'div = '.$div['re'].' '.$div['im'].'i'.'<br>');