PHP Classes
Icontem

File: example1.php


  Search   All class groups All class groups   Latest entries Latest entries   Top 10 charts Top 10 charts   Newsletter Newsletter   Blog Blog   Forums Forums   Help FAQ Help FAQ  
  Login   Register  
Recommend this page to a friend! ReTweet ReTweet Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of zandor  >  Primes Factory  >  example1.php  
File: example1.php
Role: Example script
Content type: text/plain
Description: example of prime factorization
Class: Primes Factory
Perform calculations with prime numbers
 

Contents

Class file image Download
<?php

require_once('primesfactory.php');

$n $_GET['number'];

if ( 
strlen($n) == )
{
    echo 
"No number was input.<br/>";
    echo 
"Come <a href=\"javascript:history.back(1);\">back</a> to the form and retry." ;
    return ;
}

$entries explode"," $n );
sort($entries);
$entries_count count$entries ); 

$pf = new primesfactory ;
$pf->set_style) ;

for( 
$i $i $entries_count $i++ )
{
      
$pf->insert_number$entries[$i] );
      
$pf->go();

      if ( !
$pf->isok() ) $pf->display_error();
      else
      {
        
$d $pf->display();
        echo 
"The prime factorization of <b>$entries[$i]</b> = $d<br/>" ;
      }
}

echo 
"<br/>Come <a href=\"javascript:history.back(1);\">back</a> to the form." ;

?>

 
  Advertise on this site Advertise on this site   Site map Site map   Statistics Statistics   Site tips Site tips   Privacy policy Privacy policy   Contact Contact  

For more information send a message to :
info at phpclasses dot org.
Copyright (c) Icontem 1999-2009 PHP Classes - PHP Class Scripts
  PHP Book Reviews - Reviews of books and other products