Login   Register  
PHP Classes
elePHPant
Icontem

File: example.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Richard Munroe  >  Rational  >  example.php  >  Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Examples of rational number arithmetic
Class: Rational
Perform arithmetic operations on rational numbers
Author: By
Last change:
Date: 2006-02-04 13:51
Size: 428 bytes
 

Contents

Class file image Download
<?php

include_once 'class.Rational.php' ;

$r = new Rational(12) ;
$r1 = new Rational(1/3) ;

var_dump($r) ;
var_dump($r1) ;

var_dump(Rational::subtract($r1$r)) ;
var_dump(Rational::add($r$r1)) ;

$r = new Rational(26) ;
$r->simplify() ;
var_dump($r) ;

$r = new Rational(.25) ;
$r1 = new Rational($r) ;

var_dump($r) ;
var_dump($r1) ;

var_dump(Rational::multiply($r$r1)) ;
var_dump(Rational::divide($r$r1)) ;
?>