Location: PHPKode > scripts > Rational > rational/example.php
<?php

include_once 'class.Rational.php' ;

$r = new Rational(1, 2) ;
$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(2, 6) ;
$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)) ;
?>
Return current item: Rational